#Cocochief
1 messages ยท Page 1 of 1 (latest)
Hi ๐
So you have a /month recurring price but you want a user who first signs up to get a 100% coupon for their second month?
Yes, generally speaking.
we think of it as a promo/coupon that gets applied at the time of the checkout. But the discount happens on the 2nd month, not the first.
I don't think there is a way to do that natively with a promo code but you could accomplish something similar by updating the subscription after the customer pays the first invoice with a 100% off coupon with a max_redemptions of 1 and proration_behavior set to none. This would mean the coupon would be applied to the next invoice generated.
Then this would need to be a custom promo code?
For example, if I run a promo that offers this discount to my entire userbase, I would need differenet promo code for each user?
No you could also specify the coupon duration to be only 1 month: https://stripe.com/docs/billing/subscriptions/coupons?dashboard-or-api=api#coupon-duration
However there are some pitfalls that we call out in this doc (e.g. applying a 100% off one-month coupon on a /year price).
You would specify the duration as once: https://stripe.com/docs/api/coupons/object#coupon_object-duration
And to prevent customers from applying it to yearly prices/products you can set up the Coupon to only apply to products with a /month billing cycle: https://stripe.com/docs/api/coupons/create#create_coupon-applies_to-products
wow... seems complicated.
It seems the key to making this work is to apply the coupon AFTER the first invoice is processed.
Generally, we expect that first invoice to be processed almost immediately after the user signs up for subscription, right?
If you apply it beforehand the discount will be on the first invoice
Yes the first invoice is processed immediately
We don't have to wait for the 1st period to finish before applying the coupon?
Not if you specify proration_behavior as none. This will allow you to make changes that will only be applied at the next invoice
Otherwise it will give the 100% off discount to the remaining time on the current billing period
let me take a look.
I am mapping this to our process. One other hiccup is that we use Stripe's checkout session for the actual purchase/payment. https://stripe.com/docs/api/checkout/sessions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Basically this process means that we won't be attaching the coupon when generating these checkout sessions, but would instead attach the coupon with the webhook.
That means that within the stripe checkout session, user wouldn't see this patricular discount offer. Is there a way to still show this offer to the user manually somehow?
Maybe is there a way to insert custom text into the checkout screen?
hmmm, gimme a while, let me take a look at what options are possible
th
thx
When our webhook picks up that order, our webhook would also need a way to know that this order is created with the intent of having that particular coupon.
how about adding it to the Price as a description?
i would add it to the metadata also, but which webhook event are you listening for?
metadat for the coupon or the price?
Well, we listen to all of them. I presume we would trigger off of invoice.paid ?
hrm, you can always pass it into https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata, and https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata, and the Price object too
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
although, if you create a Price specifically to identify that this is for use with that coupon, you probably wouldn't need a metadata for the Price, since you can identify it directly from the Price ID itself