Using Gravity Forms ‘gform_paypalpaymentspro_args_before_subscription’ PHP filter

The gform_paypalpaymentspro_args_before_subscription filter in Gravity Forms is used to modify the subscription arguments before they are sent to PayPal.

On this pageJump to a section

Usage

Add this filter to run for all ‘Subscription’ type PayPal Payments Pro feeds:

add_filter('gform_paypalpaymentspro_args_before_subscription', 'your_function_name', 10, 5);

Parameters

  • $subscription (array): An associative array containing the billing details, recurring payment details, setup fee, etc.
  • $form_id (integer): The ID of the form currently being processed.
  • $submission_data (Submission Data): Contains the form title, payment amount, setup fee amount, trial amount, line items created using the submitted pricing field values, and any discounts from coupons. Available from v2.0.
  • $feed (Feed Object): The Feed which is currently being processed. Available from v2.0.
  • $entry (Entry Object): The Entry which is currently being processed. Available from v2.0.

More information

See Gravity Forms Docs: gform_paypalpaymentspro_args_before_subscription

Examples

Set the Start Date

Modify the START parameter in the subscription arguments:

add_filter('gform_paypalpaymentspro_args_before_subscription', function($subscription, $form_id) {
    if ($form_id == 3) {
        $subscription['START'] = '07152015'; // date format need to be MMDDYYYY
    }
    return $subscription;
}, 10, 2);

Place this code snippet in the functions.php file of your active theme.

Source Code: This filter is located in GFPayPalPaymentsPro::subscribe() in class-gf-paypalpaymentspro.php.

Leave a Comment

Your email address will not be published. Required fields are marked *