The gform_post_payment_action Gravity Forms action hook can be used to perform custom actions after processing various payment events.
Usage
To use this action hook for all payment add-on feeds:
add_action('gform_post_payment_action', 'your_function_name', 10, 2);
Parameters
- $entry (Entry object): The entry for which the payment event occurred.
- $action (Array): An associative array containing the event details.
$action = array( 'type' => '', 'amount' => '', 'transaction_type' => '', 'transaction_id' => '', 'subscription_id' => '', 'entry_id' => '', 'payment_status' => '', 'note' => '', );
More information
See Gravity Forms Docs: gform_post_payment_action This action hook was added in Gravity Forms 1.9.10.21.
Source Code This action hook is located in GFPaymentAddOn::post_payment_action()
in includes/addon/class-gf-payment-addon.php
.
Examples
Send event notification
The following example triggers the sending of form notifications registered for the event. For a more detailed tutorial, see the Send Notifications On Payment Events article.
add_action('gform_post_payment_action', function ($entry, $action) { $form = GFAPI::get_form($entry['form_id']); GFAPI::send_notifications($form, $entry, rgar($action, 'type')); }, 10, 2);