stripe-firebase-extensions
stripe-firebase-extensions copied to clipboard
Add discount parameter for create checkout session
Feature request
- Extension name:
firestore-stripe-payments
Is your feature request related to a problem? Please describe.
I would like to create a way for my customers to automatically redeem a coupon intended only for a specific customer group. Currently you can only specify a promotion_code when creating a checkout session.
Describe the solution you'd like
It would be nice if in the future you could also pass a coupon parameter.
Stripe Api allows this via
discounts.coupon
optional
The ID of the coupon to apply to this Session.
Additional context
We could simply add coupon as a parameter and edit
if (promotion_code) {
sessionCreateParams.discounts = [{ promotion_code }];
}
to
if (promotion_code || coupon) {
sessionCreateParams.discounts = [{ promotion_code, coupon }];
}
to the createCheckoutSession function.
I have a use case where we need to pass through a coupon to track affiliates but it is breaking. Can someone direct me to why we can't pass through the coupon parameter? We need it to automatically be applied in our case when users checkout after being directed to our site by an affiliate link.
Hi,
Is there anything new about this ? It would be great to support passing a coupon ID too.
Hi,
Any news about the coupon support? According to the official stripe doc the discount array takes a coupon.
Thanks you :)
Hi,
Are you open to PR?
This bug seems to be a quick fix and I guess many people are struggling with it.