gform_paypalpaymentspro_log_api_request

gform_paypalpaymentspro_log_api_request

DescriptionUsageParametersExamplesSource Code

Description
Controls whether the API request sent to PayPal is logged.
Usage
add_filter( 'gform_paypalpaymentspro_log_api_request', 'your_function_name', 10, 1 );

Parameters

$log_request bool
True to log the request, false to not. False by default.

Examples
add_filter( 'gform_paypalpaymentspro_log_api_request', 'log_request', 10, 1 );
function log_request( $log_request ){
return true;
}

This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFPayPalPaymentsPro::post_to_payflow() in class-gf-paypalpaymentspro.php.

gform_paypalpaymentspro_args_before_subscription

gform_paypalpaymentspro_args_before_subscription

DescriptionUsageParametersExamples1. Set the Start DatePlacementSource Code

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:
1add_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:
1234567add_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.

gform_paypalpaymentspro_args_before_send

gform_paypalpaymentspro_args_before_send

DescriptionUsageParametersExamplesSource Code

Description
Allows the transaction arguments to be modified before posted to PayPal.
Usage
1add_filter( 'gform_paypalpaymentspro_args_before_send', 'your_function_name', 10, 2 );

Parameters

$nvp array
The transaction arguments.
12345678910111213141516171819202122232425Array(    [ACCT] => 4111111111111111    [EXPDATE] => 1232    [CVV2] => 111    [STREET] =>     [BILLTOSTREET2] =>     [CITY] =>     [STATE] =>     [ZIP] =>     [BILLTOCOUNTRY] =>     [CURRENCY] => USD    [FIRSTNAME] => x    [LASTNAME] => d    [EMAIL] => [email protected]    [DESC] =>     [L_NAME0] => T-Shirt    [L_DESC0] =>     [L_AMT0] => 20    [L_NUMBER0] => 1    [L_QTY0] => 2    [AMT] => 40    [TENDER] => C    [TRXTYPE] => S)

$form_id int
The ID of the current form.

Examples
12345add_filter( 'gform_paypalpaymentspro_args_before_send', 'change_args', 10, 2 );function change_args( $nvp, $form_id ){    $nvp['LASTNAME'] = 'Testing';    return $nvp;}
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFPayPalPaymentsPro::post_to_payflow() in class-gf-paypalpaymentspro.php.

gform_paypalpaymentspro_args_before_payment

gform_paypalpaymentspro_args_before_payment

DescriptionUsageParametersExamples1. Add New Parameter2. Map Billing Address to Shipping AddressPlacementSource Code

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 ) {
// Change 3 to the id number of your form.
if ( $form_id == 3 ) {
// Change 5 to the id number of the field containing the information.
$args['COMMENT1'] = rgpost( 'input_5' );
}

return $args;
}, 10, 2 );

2. Map Billing Address to Shipping Address
The following example shows how you can map the billing address to shipping address.
add_filter('gform_paypalpaymentspro_args_before_payment','gf_add_shipping_address', 10, 2 );
function gf_add_shipping_address($args, $form_id) {
gf_paypalpaymentspro()->log_debug( __METHOD__ . '(): Running...' );

$args["SHIPTOLASTNAME"] = $args["LASTNAME"];
$args["SHIPTOSTREET"] = $args["STREET"];
$args["SHIPTOCITY"] = $args["CITY"];
$args["SHIPTOSTATE"] = $args["STATE"];
$args["SHIPTOZIP"] = $args["ZIP"];
$args["SHIPTOCOUNTRY"] = $args["BILLTOCOUNTRY"];

gf_paypalpaymentspro()->log_debug( __METHOD__ . '(): Modified $args: ' . print_r( $args, true ) );

return $args;
}

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.

gform_paypalpaymentspro_api_before_send

gform_paypalpaymentspro_api_before_send

DescriptionUsageParametersExamplesPlacementSource Code

Description
Allows the API information to be modified before sending to PayPal Payments Pro.
Usage
add_filter( 'gform_paypalpaymentspro_api_before_send', 'your_function_name', 10, 2 );

Parameters

$api_info array
The API information: API_Endpoint, API_UserName, API_Password, Vendor, Partner.

$form_id int
The current form id.

Examples
add_filter( 'gform_paypalpaymentspro_api_before_send', 'change_paypal_endpoint', 10, 2 );
function change_paypal_endpoint ( $api_info, $form_id ){
$api_info['API_Endpoint'] = 'https://pilot-payflowpro.paypal.com';
return $api_info;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFPayPalPaymentsPro::post_to_payflow() in class-gf-paypalpaymentspro.php.

gform_paypal_sslverify

gform_paypal_sslverify

DescriptionUsageParametersExampleTurn off SSL verification.PlacementSinceSource Code

Description
The 「gform_paypal_sslverify」 filter in the PayPal Standard Add-On allows the sslverify setting to be modified before sending requests to PayPal.
Usage
1add_filter( 'gform_paypal_sslverify', 'your_function_name' );

Parameters

$sslverify bool
Whether to verify SSL for the request.

Example
Turn off SSL verification.
The following allows the request to be completed without SSL verification.
1add_filter( 'gform_paypal_sslverify', '__return_false' );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in version 2.5.2.
Source Code
1$sslverify = apply_filters( 'gform_paypal_sslverify', $sslverify );
This filter is located in GFPayPal::verify_paypal_ipn() in class-gf-paypal.php.