Pre populate Card Holder Name

Hello, is there a way to populate the payment form field “Cardholder Name” with a standard Name field? I’m using Authorize.net as a payment processor and I would like to populate that field with the info my users will input in the Name field.

Hi Henry. There is no easy way to do that in the UI, but you can use the name details in the Authorize.Net transaction if you like. There are two different filters, depending on whether this is a single purchase or a subscription:

Subscription:

Purchase transaction:

If you want to copy the details on the form to make it easier for your users, you could use the Populate Anything plugin from Gravity Wiz:

It has a feature called Live Merge Tags which can do that:

  • Live Merge Tags.
    Add auto-updating merge tags anywhere inside your form (e.g. labels, descriptions, choices, values, HTML content).

If you have any other questions, please let us know.

Thanks for your reply.

I just tested with Gravity Forms Populate Anything and I couldn’t find a way to auto-populate the Cardholder Name Field.

I’m also testing with the filter for the Purchase transaction you shared but It’s not working.

This is how the code looks on the website:

add_filter( 'gform_authorizenet_transaction_pre_capture', 'add_custom_field', 10, 5 );
function add_custom_field( $transaction, $form_data, $config, $form, $entry ) {
    GFCommon::log_debug( __METHOD__ . '(): running.' );
    if ( $form['id'] != 8 ) { // The correct form ID
        GFCommon::log_debug( __METHOD__ . '(): Not our desired form, leaving without changes.' );
        return $transaction;
    }
    // Set values for transaction First Name and Last Name from a name field with ID 1.
    $transaction->first_name = rgar( $entry, '1' ); // The first name field ID
    $transaction->last_name = rgar( $entry, '11' ); // The last name field ID
 
    return $transaction;
}

What I’m trying to achieve is to capture the name and last name and populate the Cardholder Name field in the payment step.

EDIT: I’m using Oxygen Builder so I can’t have a Theme. I’m using Advance Scripts and Code Snippets addons in order to test this code. It doesn’t work with any of them.

© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.