Using Gravity Forms ‘gform_trigger_payment_delayed_feeds’ PHP action

The gform_trigger_payment_delayed_feeds action hook is primarily used in GFFeedAddOn by GFPaymentAddOn based add-ons to trigger processing of feeds delayed until payment is completed.

Usage

add_action('gform_trigger_payment_delayed_feeds', 'my_function', 10, 4);

Parameters

  • $transaction_id (string) – The transaction or subscription ID.
  • $payment_feed (array) – The payment feed which originated the transaction.
  • $entry (array) – The entry currently being processed.
  • $form (array) – The form currently being processed.

More information

See Gravity Forms Docs: gform_trigger_payment_delayed_feeds

This action hook was added in Gravity Forms 2.4.13 and is located in class-gf-payment-addon.php.

Examples

Send an email after payment is completed

This example sends an email to the user after the payment is completed.

function send_email_after_payment($transaction_id, $payment_feed, $entry, $form) {
    // Get user email from the entry
    $user_email = rgar($entry, '2'); // Replace '2' with the field ID of the email field on your form

    // Email subject and message
    $subject = 'Payment Completed';
    $message = 'Thank you for your payment! Your transaction ID is ' . $transaction_id;

    // Send the email
    wp_mail($user_email, $subject, $message);
}
add_action('gform_trigger_payment_delayed_feeds', 'send_email_after_payment', 10, 4);

Update a custom post status after payment is completed

This example updates the status of a custom post related to the entry after the payment is completed.

function update_post_status_after_payment($transaction_id, $payment_feed, $entry, $form) {
    // Get the post ID from the entry meta
    $post_id = gform_get_meta($entry['id'], 'custom_post_id');

    // Update the post status
    wp_update_post(array('ID' => $post_id, 'post_status' => 'publish'));
}
add_action('gform_trigger_payment_delayed_feeds', 'update_post_status_after_payment', 10, 4);

Create a user account after payment is completed

This example creates a new user account after the payment is completed.

function create_user_after_payment($transaction_id, $payment_feed, $entry, $form) {
    // Get user data from the entry
    $username = rgar($entry, '3'); // Replace '3' with the field ID of the username field on your form
    $email = rgar($entry, '2'); // Replace '2' with the field ID of the email field on your form
    $password = wp_generate_password();

    // Create the user account
    wp_create_user($username, $password, $email);
}
add_action('gform_trigger_payment_delayed_feeds', 'create_user_after_payment', 10, 4);

Add a custom note to the entry after payment is completed

This example adds a custom note to the entry after the payment is completed.

function add_note_after_payment($transaction_id, $payment_feed, $entry, $form) {
    // Create the note content
    $note = 'Payment completed. Transaction ID: ' . $