Description

The wpforms_forms_submission_prepare_payment_meta filter fires when the payment is ready to be saved into the payments_meta table.

Parameters

$payment_meta
(array) Payment meta that will be saved into the database (payments_meta) table.
$fields
(array) Sanitized entry field values/properties.
$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms/src/Forms/Submission.php

More Information

The filter fires when the payment is ready to be saved into the payments_meta table.

Examples

/**
 * Payment meta that is ready to be saved into the payments_meta table.
 *
 * @link  https://wpforms.com/developers/wpforms_forms_submission_prepare_payment_meta/
 *
 * @param array  $payment_meta   Payment meta that will be saved into the database (payments_meta) table.
 * @param array  $fields         Sanitized entry field values/properties.
 * @param array  $form_data      Form data and settings.
*/

function wpf_wpforms_forms_submission_prepare_payment_meta( $payment_meta, $fields, $form_data ) {

    // Only process this snippet on the form ID 225
    if ( absint( $form_data[ 'id' ] ) !== 225 ) {
 
        return $properties;
    } 

	// Run code...

}
add_action( 'wpforms_forms_submission_prepare_payment_meta', 'wpf_wpforms_forms_submission_prepare_payment_meta', 10, 3 );