bookmark_bordergform_paypalpaymentspro_args_before_payment

Description

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

Usage

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

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

Parameters

  • $args array

    An associative array containing the billing details, payment amount, and line items created using the submitted pricing field values and any discounts from coupons.

  • $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. Add New Parameter

The following example shows how you can set the COMMENT1 parameter using the value from a form field. See PayPal API documentation for supported parameters.

add_filter( 'gform_paypalpaymentspro_args_before_payment', function ( $args, $form_id ) {
    if ( $form_id == 3 ) {
        $args['COMMENT1'] = rgpost( 'input_5' );
    }

    return $args;
}, 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::authorize() in class-gf-paypalpaymentspro.php