#tsr_api

1 messages ¡ Page 1 of 1 (latest)

grand cradleBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1309406125929795674

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

sly olive
#

Hi

young vale
#

If you're using Checkout Session, Stripe will validate whether a promotion code is valid before applying to the payment

#

Why are you validating the promotion code yourself?

sly olive
#

client wants to show one input field and validate promocode before clicking on checkout...

young vale
#

Which integration are you using? Checkout Session, Payment Element... etc?

sly olive
#

in checkout it is showing field to enter promocode... but client wants to enter before clicking on checkout

young vale
#

Do you allow customer enter promotion code in the Checkout Session, i.e. allow_promotion_codes set to true? https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-allow_promotion_codes

If yes, validating before redirecting to Checkout Session doesn't help as customer can still enter other promotion code.

sly olive
#

If I set allow_promotion_codes to false, can I still pass a promo code to the checkout during session creation for validation purposes?

young vale
#

Do you mean passing the promotion code directly to discounts.promotion_code: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-discounts-promotion_code?

If so, Checkout Session creation will fail if the promotion code is invalid.

Alternatively, you can use Promotion Code Retrieval API to check it active status: https://docs.stripe.com/api/promotion_codes/retrieve

sly olive
#

i am creating promocode for a sepecific product, so I can pass while creating checkoutssion then...

#

Another question: We have two checkout options - normal checkout and buy now, pay later. For the buy now, pay later option, can I display only the available payment options for that specific method?

young vale
#

Could you share what "buy now, pay later option" does? Do you mean you will save customer's payment first then charge later, or are you referring to Buy Now Pay Later payment methods such as Klarna?

sly olive
#

yes like klarna

young vale
sly olive
#

okay sure , thanks