#-vineet_best-practices
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/1428520817024831489
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
Hi there,
just to clarify, you want the amount of all items before taxes and discounts? That would be the amount_subtotal property on the Checkout Session object https://docs.stripe.com/api/checkout/sessions/object?api-version=2025-09-30.clover#checkout_session_object-amount_subtotal
according to types, it can be number | null
so is that a dependable way to get the subtotal ?
Yes it can be null, for example a Checkkout Session with a $0 dollar product or trial
which other cases will trigger this
?
I can't think of other situations other than the $0 dollar products or free trials at the moment.
If a user checks out with products/services that have a price >$0 dollar, it will be reflected in the amount_subtotal property.
okay
So listening to the checkout.session.completed webhook event and inspecting the amount_subtotal makes the most sense in your case.
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
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