gform_authorizenet_transaction_pre_capture_setup_fee

Description

This filter can be used to modify the transaction object for the subscription setup fee before it is sent to Authorize.net.

Usage

The filter which would run for all ‘subscription’ type Authorize.net feeds with a setup fee can be used like so:

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

Parameters

  • $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 Form Object

    The form which is currently being processed.

  • $entry Entry Object

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

Examples

1. Modify the Amount

The following example shows how you can override the setup fee for a specific form.

add_filter( 'gform_authorizenet_transaction_pre_capture_setup_fee', 'set_fee_amount', 10, 4 );
function set_fee_amount( $transaction, $form_data, $config, $form ) {
    if ( $form['id'] == 10 ) {
        $transaction->amount = 50;
    }

    return $transaction;
}

Placement

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

Source Code

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