#D4reDev1l.

1 messages · Page 1 of 1 (latest)

versed craterBOT
neat skiff
#

Hi, are you asking if you can apply both the coupon and the promo to a subscription? Or something else?

quartz mulch
#

I want to migrate from apply coupon to apply promo code to subscription

#

and I want to make promo code active in the coupon dashboard

neat skiff
quartz mulch
#

but how to apply promo code to subscription?

neat skiff
quartz mulch
#

I am using Stripe.Subscription and add coupon id to coupon field with stripe.subscription.update()

#

like this

neat skiff
#

On that update call, you can pass promotion_code

quartz mulch
#

is this?

neat skiff
#

yeap

quartz mulch
#

maybe I need to handle if promo code is invalid

#

currently I use this

#

based on stripe error handle doc

neat skiff
#

Hhm, are you just talking out loud or is there a question for me here?

quartz mulch
#

I was asking about is it way to handle error in stripe right?

#

I am not sure

neat skiff
#

Yeah, that is handled by stripe. Like if the promotion code does not exist on your account, it will error out. You should try sending a non valid promo code and see the error it returns.

quartz mulch
#

ok

#

is there a list for all error type for all stripe types?

neat skiff
#

Can you add more clarity here?

quartz mulch
#

I define type StripeCustomer = Stripe.Customer in typescript, is there a way to do it with errors?

neat skiff
#

What do you mean by this? Do what?

#

Did you try passing an invalid promo code to the above subscription update request? Do you not see an error?

quartz mulch
#

I should use stripe error handling, I am think it wrong. I thought I should handle errors.

#

my bad

neat skiff
#

From what you're looking yes, when you pass an invalid coupon Stripe will send an error.

quartz mulch
#

if using stripe error handling and send 404 from backend to frontend. it will show 404 in the browser console. is it ok?

neat skiff
quartz mulch
#

maybe I just concern too much

#

I developed with spring a lot, just move to nextjs

quartz mulch
#

that's it

#

thank you sir

#

^_^