#defekt7x_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1366796586029420575
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Unfortunately payment intents don't support the promo codes or coupons API, so we don't have an official way to increment the count here. I think you will have to keep your own count
Ok I just didn't know if I was approaching this the right way. Is Payment Intents still the recommended approach for apps creating a custom checkout flow for one-time payments?
Yep, direct payment intent flows are still definitely supported. We did recently release embedded checkout and embedded components checkout as well, I forget if they support promotion codes but am double checking
https://docs.stripe.com/checkout/embedded/quickstart
https://docs.stripe.com/checkout/custom/quickstart
Yep looks like they both do. Here is the specific method for it with custom checkout https://docs.stripe.com/js/custom_checkout/apply_promotion_code
Thanks. I'll have to figure out if doing a refactor to this is worth the effort. I did initially start with a Stripe-hosted checkout page but ran into some limitations so I decided to go the custom route. I wonder if trying the embedded approach would help or cause more issues.
Anyway, thanks for your help!
Makes sense, let us know if you run into anything else. Fingers crossed for minimal new issues ๐ค
real quick: chatGPT is saying I can attach a promotion code to a customer before creating the payment Intent and it should be linked properly once they make a successful payment
await stripe.customers.update(customerId, {
discount: {
promotion_code: promoCode.id,
},
});
is this one way to work around the issue?
ok I think it's hallucinating
"Object literal may only specify known properties, and 'discount' does not exist in type 'CustomerUpdateParams'."
job security for another day
We did actually only recently remove that field from the customer object in our most recent API version basil. So it could be a workaround technically, but would make trouble in the future as the field is unlikely to be added back
https://docs.stripe.com/api/customers/update?lang=curl&api-version=2025-02-24.acacia#update_customer-promotion_code