gform_authorizenet_form_data

Description

This filter can be used to modify the form submission data before it is used to create the Authorize.net transaction.

This hook has been deprecated. Please use gform_submission_data_pre_process_payment instead.

Usage

The filter which would run for all Authorize.net feeds can be used like so:

add_filter( 'gform_authorizenet_form_data', 'your_function_name', 10, 4 );

You can also target a specific form by appending the form id on the end of the hook name like so:

add_filter( 'gform_authorizenet_form_data_4', 'your_function_name', 10, 4 );

Parameters

  • $form_data Form DataAn associative array containing the form title, billing address, payment amount, setup fee amount, line items created using the submitted pricing field values and any discounts from coupons.
  • $form Form Object

    The form which is currently being processed.

  • $config Authorize Net Config

    The feed which is currently being processed.

Examples

1. Change fee_amount

The following example shows how you can change the setup fee depending on the value of a form field.

add_filter( 'gform_authorizenet_form_data', function ( $form_data, $form, $config ) {
    if ( rgpost( 'input_1' ) == 'some value' ) {
        $form_data['fee_amount'] = 0;
    }

    return $form_data;
}, 10, 4 );

Placement

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

Source Code

This filter is located in GFAuthorizeNet::get_form_data() in authorizenet.php.