Gravity Forms has a Stripe add-on that allows you to charge your users at form submission using your Stripe.com account, but this add-on doesn’t support (currently) coupons created at your Stripe account.
Gravity Forms has a also its own Coupons add-on. Using this add-on you can create a workaround for the mentioned limitation of the Stripe add-on.
Basically we’re going to use the coupon at Stripe.com, a coupon created in the Gravity Forms Coupons add-on with the same name and discount, and a little snippet of code. Simply follow the steps below.
Create the coupon in Gravity Forms
Go to Forms -> Coupons menu and create your coupon.
If you already have the coupon created at your Stripe.com account make sure you use in the Coupon Code field the same value you used in ID (Code) at your Stripe.com account.
Create the coupon at your Stripe.com account
If you already have the coupon created in your Stripe.com account you can skip this step, if not, go to Subscriptions -> Coupons in your Stripe.com and create the coupon.
Make sure to use in ID (Code) the same value you used in Coupon Code field in Gravity Forms.
Use a filter to override the payment amount sent to Stripe.com
If you’re not using the form total as payment amount in your feed, you can skip this step.
Assuming that you’re using the Form Total as recurring amount in your Stripe add-on subscription feed. As the Gravity Forms Coupons add-on applies the discount to the form total, you will want to alter the amount passed to Stripe.com to prevent the discount from being applied two times, one by the Coupons add-on and then by Stripe.com
To do this you can use the first example snippet in the doc page for gform_submission_data_pre_process_payment filter, you can find it below with some extra lines to log the process with logging enabled if you have any issue:
If you did all steps above as explained, now the Gravity Forms Coupons add-on will apply the discount to your form and entry. Then the original amount for the Total field, without the discount, will be passed to Stripe.com and there the Stripe coupon will be applied.
You’re done :)
By the way, note that although we’re using the above snippet to pass the form total without a discount to Stripe.com in this use case, you can use the snippet also to alter the payment amount passed to any other payment add-on based on the Add-on Framework.