gform_post_payment_transaction

Description

Triggered after a payment transaction is created within Gravity Forms.

Usage

add_action( 'gform_post_payment_transaction', 'my_function', 10, 6 );

Parameters

ParameterTypeDescription
$txn_idintegerThe transaction ID associated with the payment.
$entry_idintegerThe ID of the entry that was created.
$transaction_typestringThe type of transaction that was made.
$transaction_idintegerThe transaction ID of the newly created transaction.
$amountstringThe total amount of the payment.
$is_recurringboolReturns true if recurring. Otherwise, false.

Examples

function my_function() {
    // Do something here

    // If data from the Stripe webhook event is needed (and this hook was initiated via a Stripe webhook request), you can access event data with the following line:
    $event = gf_stripe()->get_webhook_event();
    if ( $event ) {
       // Access webhook event data. For event object documentation, see: https://stripe.com/docs/api/events/object
    }
}
add_action( 'gform_post_payment_transaction', 'my_function', 10, 6 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

do_action( 'gform_post_payment_transaction', $txn_id, $entry_id, $transaction_type, $transaction_id, $amount, $is_recurring );

This action hook is located in GFPaymentAddOn::insert_transaction() in includes/addon/class-gf-payment-addon.php.