#t90-coupon-subscription
1 messages · Page 1 of 1 (latest)
@clear thunder How did you create that Checkout Session? Via the API or the Dashboard?
Via the API
Do I need to pass the discount ID ?
Here's the code used to create the checkout session
return this.stripe.checkout.sessions.create({
mode: 'subscription',
customer: brand.stripe_customer_id,
line_items: [
{
price: priceId,
quantity: brandUsers.length,
},
],
success_url: `${getAppUrl()}/settings/billing?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${getAppUrl()}/settings/billing`,
billing_address_collection: 'required',
customer_update: {
address: 'auto',
name: 'auto',
},
automatic_tax: {
enabled: true,
},
tax_id_collection: {
enabled: true,
},
subscription_data: {
metadata: {
payingUserId: user._id.toString(),
},
},
});
you forgot this parameter https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-allow_promotion_codes
Awesome, thank you