gform_paypalpaymentspro_args_before_subscription

Description

This filter can be used to modify the subscription arguments before they are sent to PayPal.

Usage

The filter which would run for all ‘Subscription’ type PayPal Payments Pro feeds can be used like so:

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.

Examples

1. Set the Start Date

The following example shows how you can set the START parameter:

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 );

Placement

Your code snippet should be placed in the functions.php file of your active theme.

Source Code

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