Description

The wpforms_forms_submission_prepare_payment_data filter collects information about the payment and will fire when the payment is ready to be saved into the main payments table, which is used for displaying a list of payments and partially for search.

Parameters

$payment_data
(array) Information about the payment, that will be saved into the database.
$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 collects information about the payment and will fire when the payment is ready to be saved into the main payments table, which is used for displaying a list of payments and partially for search.

Examples

/**
 * Used to gather information about the payment before being saved to the main payments table.
 *
 * @link  https://wpforms.com/developers/wpforms_forms_submission_prepare_payment_data/
 *
 * @param array  $payment_data   Information about the payment, that will be saved into the database.
 * @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_data, $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_data', 'wpf_wpforms_forms_submission_prepare_payment_meta', 10, 3 );