Description
This hook is fired after an entry’s payment status has been updated and the payment was for the PayPal Standard Add-on.
Usage
add_action( 'gform_post_payment_status', 'your_function_name', 10, 8 );
Parameters
- $feed Feed Object
The PayPal configuration feed used to generate the transaction.
-
$entry Entry Object
The entry from which the transaction was originally generated.
-
$status string
The new payment status for this transaction.
-
$transaction_id string
The PayPal transaction ID for this transaction.
-
$subscriber_id integer
The PayPal subscriber ID for this transaction. Will be empty if the transaction is a one-time payment.
-
$amount float
The amount of the transaction.
-
$pending_reason string
If the payment status is set to “Pending”, the reason will be passed in this variable.
-
$reason string
If the payment status is set to “Reversed”, “Refunded”, or “Canceled_Reversal” the reason for this change will be provided in this variable.
Examples
This example shows how to notify the site admin when a payment is completed or a special case.
add_action( 'gform_post_payment_status', 'admin_payment_notification', 10, 8 ); function admin_payment_notification( $feed, $entry, $status, $transaction_id, $subscriber_id, $amount, $pending_reason, $reason ) { $admin_email = get_bloginfo( 'admin_email' ); if ( $status == 'Completed' ) { wp_mail( $admin_email, 'Payment Successful!', 'Message about the successful payment' ); } elseif( $status == 'Refunded' || $status == 'Reversed' || $status 'Canceled_Reversal' ) { wp_mail( $admin_email, "Payment $status", "There was an issue with this payment: $reason" ); } }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
do_action( 'gform_post_payment_status', $feed, $entry, $status, $transaction_id, $subscriber_id, $amount, $pending_reason, $reason )
This hook is located in GFPayPal::post_callback() in class-gf-paypal.php.