gform_post_payment_action

gform_post_payment_action

DescriptionUsageParametersExamples1. Send event notificationPlacementSource CodeSince

Description
This action hook can be used to perform custom actions after processing of the following payment events has occurred:

complete_payment
refund_payment
fail_payment
add_pending_payment
void_authorization
create_subscription
cancel_subscription
expire_subscription
add_subscription_payment
fail_subscription_payment
fail_create_subscription

Usage
This action hook, which would run for all payment add-on feeds, can be used like so:
1add_action( 'gform_post_payment_action', 'your_function_name', 10, 4 );

Parameters

$entry Entry Object
The entry for which the payment event occurred.

$action array
An associative array containing the event details.
12345678910$action = array(    'type'             => '',    'amount'           => '',    'transaction_type' => '',    'transaction_id'   => '',    'subscription_id'  => '',    'entry_id'         => '',    'payment_status'   => '',    'note'             => '',);

Examples
1. Send event notification
The following example shows how you can trigger the sending of form notifications registered for the event. See the Send Notifications On Payment Events article for a more detailed tutorial.
1234add_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 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
1do_action( 'gform_post_payment_action', $entry, $action );
This action hook is located in GFPaymentAddOn::post_payment_action() in includes/addon/class-gf-payment-addon.php.
Since
This filter was added in Gravity Forms 1.9.10.21.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注