stripe-firebase-extensions icon indicating copy to clipboard operation
stripe-firebase-extensions copied to clipboard

Add discount parameter for create checkout session

Open felixjunghans opened this issue 3 years ago • 5 comments

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.

felixjunghans avatar Nov 30 '21 22:11 felixjunghans

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.

ryanwhitemedia avatar Jan 05 '23 20:01 ryanwhitemedia

Hi,

Is there anything new about this ? It would be great to support passing a coupon ID too.

aurelien-brabant avatar Feb 19 '23 17:02 aurelien-brabant

Hi, Any news about the coupon support? According to the official stripe doc the discount array takes a coupon. Thanks you :)

igalil avatar Feb 19 '23 18:02 igalil

Hi,

Are you open to PR?

This bug seems to be a quick fix and I guess many people are struggling with it.

kevinpiac avatar Feb 19 '23 18:02 kevinpiac