Change the Gravity Forms Stripe Statement Descriptor

If you’re taking payments on your Gravity Form using the Gravity Forms Stripe Add-On, you may have noticed that there’s no setting to be able to specify the statement descriptor that Stripe uses. In other words, there’s no way to change what is displayed on your customer’s bank statement, as Gravity Forms default to what you have set in your Stripe account.

That’s all well and good, but what if you need to show something different on the statement descriptor? Perhaps you have several brands that you run through the one Stripe account. Or maybe you need to have something different show up depending on which form has been used.

Well, fear not, as we have a snippet that allows you to specify the statement descriptor when sending the charge from Gravity Forms through to Stripe.

Before getting started, it’s worthwhile checking out the Stripe documentation for the statement descriptor requirements, as they’re quite strict on what is and isn’t allowed.

Change Statement Descriptor on All Forms

To change the statement descriptor for all forms on your site, add the following snippet, and change your statement descriptor on line 4:

add_filter( 'gform_stripe_charge_pre_create', 'snippetpress_gf_stripe_statement_descriptor' ); 
function snippetpress_gf_stripe_statement_descriptor( $payment_data ) {

    $custom_descriptor = 'Your Custom Descriptor'; // Set your custom statement descriptor here

    $payment_data['statement_descriptor'] = $custom_descriptor; 

    return $payment_data; 
}

Change Statement Descriptor on Specific Forms

To change the statement descriptor for specific forms on your site, add the following snippet, specify the form IDs in the $form_ids array on line 4, and change your statement descriptor on line 6:

add_filter( 'gform_stripe_charge_pre_create', 'snippetpress_gf_stripe_statement_descriptor', 10, 4 ); 
function snippetpress_gf_stripe_statement_descriptor( $payment_data, $feed, $submission_data, $form ) {

    $form_ids = array( 123, 456, 789 ); // Add your form IDs here

    $custom_descriptor = 'Your Custom Descriptor'; // Set your custom statement descriptor here
    
    if( in_array( $form['id'], $form_ids ) ){
        $payment_data['statement_descriptor'] = $custom_descriptor;
    }

    return $payment_data; 
}

Where to add the snippet?

Whichever snippet you choose to use, you should place it at the bottom of the functions.php file of your child theme. Make sure you know what you’re doing when editing this file. Alternatively, you can use a plugin such as Code Snippets to add the custom code to your WordPress site. If you need further guidance on how to add the code, check out our post on How to Add WordPress Snippets.