Using Gravity Forms ‘gform_paypal_get_payment_feed’ PHP filter

The gform_paypal_get_payment_feed Gravity Forms filter allows you to modify the payment feed configuration before it’s processed by the PayPal add-on.

Usage

add_filter('gform_paypal_get_payment_feed', 'your_function_name', 10, 3);

Parameters

  • $feed (Feed Object): The current payment feed.
  • $entry (Entry Object): The current form entry.
  • $form (Form Object): The current form.

More information

See Gravity Forms Docs: gform_paypal_get_payment_feed

Examples

Change Feed Name

Modify the payment feed’s name before processing.

add_filter('gform_paypal_get_payment_feed', 'change_feed_name', 10, 3);
function change_feed_name($feed, $entry, $form) {
    $feed['meta']['feedName'] = 'New Feed Name';
    return $feed;
}

Change Transaction Type

Set the transaction type to “Subscription” for a specific form.

add_filter('gform_paypal_get_payment_feed', 'set_transaction_type', 10, 3);
function set_transaction_type($feed, $entry, $form) {
    if ($form['id'] == 5) {
        $feed['meta']['transactionType'] = 'subscription';
    }
    return $feed;
}

Modify Payment Amount

Increase the payment amount by 10% for all payments.

add_filter('gform_paypal_get_payment_feed', 'modify_payment_amount', 10, 3);
function modify_payment_amount($feed, $entry, $form) {
    $feed['meta']['paymentAmount'] *= 1.1;
    return $feed;
}

Add Custom Note

Add a custom note to the payment feed based on the entry data.

add_filter('gform_paypal_get_payment_feed', 'add_custom_note', 10, 3);
function add_custom_note($feed, $entry, $form) {
    $customer_name = rgar($entry, '1.3') . ' ' . rgar($entry, '1.6');
    $feed['meta']['note'] = "Payment from: {$customer_name}";
    return $feed;
}

Disable Payment Feed for Specific Entry

Disable the payment feed for entries with a specific value in a field.

add_filter('gform_paypal_get_payment_feed', 'disable_payment_feed', 10, 3);
function disable_payment_feed($feed, $entry, $form) {
    if (rgar($entry, '2') == 'disable_payment') {
        return false;
    }
    return $feed;
}

Note: Replace the field ID ‘2’ with the actual field ID you want to check the value for.