Using Gravity Forms ‘gform_paypal_fulfillment’ PHP action

The gform_paypal_fulfillment action runs when a transaction is completed successfully using the PayPal Standard Add-on. It can be used to trigger 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.

More information

See Gravity Forms Docs: gform_paypal_fulfillment

Examples

Add order to a third-party order fulfillment system

This example shows how to add 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);
}

Place this code in the functions.php file of your active theme.