Changing Stripe Payment Description

We are using forms to collect payments from members of different groups. Each group has its own unique form. We’d like to change the payment description in Stripe to show the name of the form the payment is coming from. I’ve read this article (https://docs.gravityforms.com/changing-payment-description-stripe-add-on/) about changing the description, but I’m not sure what to put to change it to the form title. Any help would be appreciated!

Hi Kathy, Welcome!

You can get the form ID from the entry, and use that to get the form, and get the form title from the $form. Try this:

add_filter( 'gform_stripe_charge_description', 'change_stripe_description', 10, 5 );
function change_stripe_description( $description, $strings, $entry, $submission_data, $feed ) {
	// get the $form from the form_id which is in the entry
	$form = GFAPI::get_form ( rgar ( $entry, 'form_id' ) );
	// get the form title from the $form
	$new_description = $description . ' for ' . $form['title'];
	return $new_description;
}

If your product description was “Donation” and your form title was “Save the Whales” your new charge description would be “Donation for Save the Whales”. Let me know if you need anything different.

Hi Chris,

I have a query that’s quite similar to Kathy’s and was wondering if you wouldn’t mind having a look please?

We’ve got a scenario where we have multiple forms and we’d like to get one of the fields that is common to all the forms to be sent to the Stripe charge description. The only problem is that because these forms have evolved independently of each other the field ID numbers for said field are all different.

So I was wondering if we could grab a field based on its label instead since those we can control across all the forms? And if possible would you be able to provide an example of how that code might look please?

Many thanks
Peter