Using Gravity Forms ‘gform_authorizenet_transaction_pre_capture_setup_fee’ PHP filter

The gform_authorizenet_transaction_pre_capture_setup_fee filter allows you to modify the transaction object for the subscription setup fee before it is sent to Authorize.net.

Usage

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

Parameters

  • $transaction (object): The Authorize.net transaction object.
  • $form_data (array): 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 (array): The feed which is currently being processed.
  • $form (array): The form which is currently being processed.
  • $entry (array): The entry which is currently being processed (since version 2.1.8).

More information

See Gravity Forms Docs: gform_authorizenet_transaction_pre_capture_setup_fee

Examples

Modify the Amount

This example shows how to 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;
}

Place this code snippet in the functions.php file of your active theme.

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