Description
This hook runs when a transaction is completed successfully for the PayPal Standard Add-on and can be used to fire actions dependent on a successful PayPal transaction.
Usage
add_action( 'gform_paypal_fulfillment', 'your_function_name', 10, 4 );
Parameters
- $entry Entry Object
The entry used to generate the PayPal transaction.
-
$feed Feed Object
The PayPal Feed configuration data used to generate the order.
-
$transaction_id string
The transaction ID returned by PayPal.
-
$amount float
The amount of the transaction returned by PayPal.
Examples
Below is a fictional example of adding a successful order to a third party order fulfillment system.
add_action( 'gform_paypal_fulfillment', 'process_order', 10, 4 ); function process_order( $entry, $feed, $transaction_id, $amount ) { // get first and last name from $entry $order_id = rgar( $entry, 'id' ); $first_name = rgar( $entry, '2.3' ); $last_name = rgar( $entry, '2.6' ); // use fictional function to add order to fictional My Third Party application mtp_add_order( $transaction_id, $amount, $order_id, $first_name, $last_name ); }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
do_action( 'gform_paypal_fulfillment', $entry, $feed, $transaction_id, $amount )
This hook is located in GFPayPal::fulfill_order() in class-gf-paypal.php.