#guilty_barnacle

1 messages · Page 1 of 1 (latest)

unborn masonBOT
gray wind
#

hello! are you taking one time payments only? i.e. not Subscriptions?

copper surge
#

it is a subscription, sorry for not being clear on this

#

basically we have a yearly and a monthly subscription and I want to allow a user to entry a code that i've sent to the individuals and have the discount applied, and then reflex on the checkout button (updated price)

gray wind
#

So the Payment Element itself doesn't support entering a promo code, you'll have to build that input field yourself.

I think the way you might want to go about this is to use https://stripe.com/docs/api/invoices/upcoming to preview the Invoice first with the discount / coupon. Then create the Subscription with the same details

copper surge
#

will this work as a user is setting up there subscription for the first time?

gray wind
#

yep, it will, so if you don't provide a subscription id, but provide subscription_items, you will preview creating a subscription with those items.

copper surge
#

so our current implementations creates a subscription stripe.subscriptions.create, (server side) and then in the next step we call the stripe.confirmPayment (client side)

so in would the promo-code be applied when i create the subscription? meaning can i use a promo-code to resolve the discount object and apply that to the subscription creation? then use the upcoming invoice endpoint to retrieve the subscription and display that or would the applie promo code reflec in the paymentElement if its been applied to the subscription on creation?

#

oo i see there is a promotion code field available on the create subscription endpoint can i just pass that code in when creating the subnscription?

gray wind
#

generally, there's a possibility that your customer will key in a promo code and then get it wrong. There's where the upcoming invoice comes into play, it allows them to preview if the promo code has been applied and how much they will pay for the Subscription.

Subsequently, once the customer is sees that is the amount they will pay for the subscription and chooses to proceed, you can create the Subscription with the same parameters (and promo code)

copper surge
#

okay,cool thank you, so before i create the subscription i want to have them enter the Promo-code, then create a upcomming invoice for those items, and present it to my user, then once the user is satisfied we create the subscription and proceed to confirming the payment. do i understand correctly?

gray wind
#

that's how i envision it, but maybe test it out and see if that makes sense for you too?

copper surge
#

I think that makes sense, i kinda now have to see what my colleagues did and see how i can make this a seemless experiance for our users

#

last question. on the stripe dashboard i can create promo codes in the coupons section correct?

gray wind
#

yep!

copper surge
#

awesome thanks

gray wind
#

feel free to reach out again in case you're running into issues 😄

copper surge
#

I will do, shall i reach out in the main chat again?

gray wind
#

yep, reach out in the main chat again. Threads are generally closed after a period of time

copper surge
#

cool

#

thanks again

unborn masonBOT