#excid3 - Promo Code

1 messages · Page 1 of 1 (latest)

lucid trout
#

If you want to do apply a pomotion code on the same page as your payment element you would need to code that part of the interface yourself. It's not currently a part of payment elements.

spice linden
#

I get that part

#

Am I forced to create another incomplete subscription and then re-render the PaymentElement with the new clientSecret for that one?

#

Since it's not going to update the invoice for the original subscription used for rendering the page

lucid trout
#

Am I forced to create another incomplete subscription and then re-render the PaymentElement with the new clientSecret for that one?
Are you collecting new payment method information?

spice linden
#

Depends if the customer has paid previously or not

#

We may not show the Payment Element if they're using their existing default payment method

#

I would expect applying a promo code to an incomplete subscription to also update the draft invoice & payment intent, I guess

lucid trout
#

That is still an Update API call, not a Create call

#

You can’t apply a promotion code with amount restrictions on the Customer object or on a subscription update API call
From the docs

spice linden
#

I'm not sure what you mean?

#

For example, I have a 50% off forever promo code

#

To render the checkout page, I need to create an incomplete subscription and retrieve the invoice's payment intent to render the PaymentElement

#

but how do I let the user apply the promo code in that process?

lucid trout
spice linden
#

So there's no way to create the same experience as Stripe Checkout where everything is handled on one page?

lucid trout
#

You could probably do it with a lot of work on your back-end/front-end. Create a sub without one to render the elements, if the user enters a promo-code create a new sub, return the last_invoice.payment_intent.client_secret to the front-end, re-render the payment elements.

spice linden
#

The problem with that is we'd have to re-render the PaymentElement and would lose any entered information

#

If they added a promo code after filling out their payment method details 😦