bookmark_bordergform_authorizenet_amount_pre_authorize

Description

This filter can be used to modify the authorization amount before it is sent to Authorize.net.

Usage

The filter which would run for all ‘product and services’ type Authorize.net feeds can be used like so:

add_filter( 'gform_authorizenet_amount_pre_authorize', 'your_function_name', 10, 6 );

Parameters

  • $auth_amount float

    The authorization amount. Defaults to value of $config[‘amount’].

  • $transaction object

    The Authorize.net transaction object.

  • $form_data Form Data

    An 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.

  • $config Authorize.net Config

    The feed which is currently being processed.

  • $form

    The form which is currently being processed.

  • $entry Entry Object

    The entry which is currently being processed. Since version 2.1.8.

Example

The following example shows how you can override the authorization amount.

add_filter( 'gform_authorizenet_amount_pre_authorize', 'change_amount', 10, 4 );
function change_amount( $auth_amount, $transaction, $form_data, $config, $form ) {
    if ( $form['id'] == 10 ) {
        $auth_amount = 1;
    }

    return $auth_amount;
}

Placement

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

Source Code

This filter is located in GFAuthorizeNet::authorize() in class-gf-authorizenet.php