Reputation: 6049
To enable SCA changes, I am now integrating https://stripe.com/docs/payments/checkout/client stripe's (stripe v3 js file) checkout feature to my app, which makes it easy for integration of my subscription system.
Question
how to pass coupons to stripe.redirectToCheckout()
method, don't see anything related to this in documentation.
code sample
stripe.redirectToCheckout({
items: plans_and_addons,
successUrl: successUrl,
cancelUrl: cancelUrl,
clientReferenceId: customer_id, // helpful in webhook response
})
Upvotes: 15
Views: 25272
Reputation: 221
As Daniel says above, you can't enable the promo codes when you call redirectToCheckout
but you can enable the promo codes when you create the stripe session from your API.
So, to sum app, when you create the checkout session using Stripe.checkout.sessions.create()
you have to also pass the allow_promotion_codes: true
and this will actually allow you to apply promo codes to the products you have created in the stripe -> products page.
You can find more informations on this page: https://stripe.com/docs/billing/subscriptions/coupons/codes
Upvotes: 20
Reputation: 394
I also ran into this, and what I've deduced from the Stripe docs is that you can't apply a coupon directly to the redirectToCheckout
method, you have to create a Checkout session first and then use that.
redirectToCheckout
Reference Docs doesn't mention a discount or coupon parameter at all, and the sample code again is creating a Checkout session using fetch
(to one's own server backend, which is where my expertise ceases and where I'm stifled), to generate a session ID and then passing that into the result where redirectToCheckout
is called.Upvotes: 4
Reputation: 248
I am also facing the same issue so I contacted stripe support.
Please check the support team's reply.
I did a thorough research on your query and I'm afraid, Checkout supports only a limited set of customizations (e.g. name, description, logo) and fields. Focusing the UI allows us to iterate on it more effectively to improve conversions and maintain support across a wide range of platforms.
They provided me one document link you can also check it. https://stripe.com/docs/payments/checkout/customization
I think you can solve your problem by creating custom checkout with helping stipe API. --not tried.
Upvotes: 7