#vickygiyst
1 messages · Page 1 of 1 (latest)
Hi
You can achieve that with PaymentLink but not Checkout:
https://stripe.com/docs/payment-links/customer-info#:~:text=your payment page.-,prefilled_promo_code,-Use prefilled_promo_code to
but that will not help me
Try create the Checkout session with the discounts:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-discounts
You want to create a Checkout session with a discount right ?
yes, basically i want to give user an option where they can enter coupon code
Ah sorry, I though you want to prefill a coupon on their behalf
no
In that case, when creating the checkout session configure it to accept promotion code:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-allow_promotion_codes
yes, that i have done. but i want to give an input box to the user on checkout page
Could you please share a Checkout Session Id and a screenshot of what you want to acheive ?
You didn't specify the allow_promotion_codes
when created the Checkout Session
You need to update your Checkout Session request according to this:
const session = await stripe.checkout.sessions.create({
line_items: [
{
price_data: {
unit_amount: 2000,
product_data: {
name: 'T-shirt',
},
currency: 'usd',
},
quantity: 1,
},
],
mode: 'payment',
allow_promotion_codes: true,
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});