AI Summary
Description
The wpforms_paypal_standard_process_complete action fires when PayPal returns the status of the payment processed from the form.
Parameters
- $fields
- (array) Sanitized entry field values/properties.
- $form_data
- (array) Processed form settings/data, prepared to be used later.
- $payment_id
- (int) PayPal Payment ID.
- $data
- (array) PayPal Web Accept Data.
Source
wpforms-paypal-standard/class-paypal-standard.php
More Information
The action will process when PayPal notifies the site of the payment status.
Examples
/**
* Fires when PayPal payment status notifies the site.
*
* @link https://wpforms.com/developers/wpforms_paypal_standard_process_complete/
*
* @param array $fields Sanitized entry field values/properties.
* @param array $form_data Form data and settings.
* @param int $payment_id PayPal Payment ID.
* @param array $data PayPal Web Accept Data.
*/
function wpf_paypal_standard_process_complete( $fields, $form_data, $payment_id, $data ) {
if ( empty( $data[ 'payment_status' ] ) || strtolower( $data[ 'payment_status' ] ) !== 'completed' ) {
return;
}
// Run code...
}
add_action( 'wpforms_paypal_standard_process_complete', 'wpf_paypal_standard_process_complete', 10, 4 );
Related
Tutorial Reference: How to Approve a User After a PayPal Payment