#-vineet_best-practices

1 messages ¡ Page 1 of 1 (latest)

flint condorBOT
#

👋 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/1428520817024831489

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

velvet oriole
#

all i want to get is a dependable way to get the total amount user requested to create the paymentIntent / checkout session with. doesn't matter if the user was charged $0, any amount between 0 and the amount he created with or the actual amount he created with.

crimson bough
velvet oriole
#

according to types, it can be number | null

#

so is that a dependable way to get the subtotal ?

crimson bough
#

Yes it can be null, for example a Checkkout Session with a $0 dollar product or trial

velvet oriole
#

so in those cases what should i do ?

#

that can lead to issues surely

velvet oriole
#

?

crimson bough
#

If a user checks out with products/services that have a price >$0 dollar, it will be reflected in the amount_subtotal property.

velvet oriole
#

okay

crimson bough
#

So listening to the checkout.session.completed webhook event and inspecting the amount_subtotal makes the most sense in your case.

velvet oriole
#

0kay got it

#

also when creating coupons and have the duration set to once, in test mode i can redeem it many time. will it differ in behaviour on prod ?

#

@crimson bough

crimson bough
#

When duration is set to once, it applies to the first charge from a subscription with this coupon applied. That means it can be reused. If you want to limit how many times a coupon in total (across all customers) can be used you would need to set the max_redemption parameter when creating the coupon. https://docs.stripe.com/api/coupons/object#coupon_object-max_redemptions

flint condorBOT