#Cocochief

1 messages ยท Page 1 of 1 (latest)

craggy flaxBOT
lime pendant
#

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?

wide vortex
#

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.

lime pendant
#

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.

wide vortex
#

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?

lime pendant
#

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).

wide vortex
#

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?

lime pendant
#

If you apply it beforehand the discount will be on the first invoice

#

Yes the first invoice is processed immediately

wide vortex
#

We don't have to wait for the 1st period to finish before applying the coupon?

lime pendant
#

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

wide vortex
#

let me take a look.

#

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?

burnt pecan
#

hmmm, gimme a while, let me take a look at what options are possible

wide vortex
#

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.

burnt pecan
#

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?

wide vortex
#

metadat for the coupon or the price?

#

Well, we listen to all of them. I presume we would trigger off of invoice.paid ?

burnt pecan
#

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