#cansozbir-discount-checkout
1 messages ยท Page 1 of 1 (latest)
sorry, probably I couldn't explain it clearly, just a junior dev here ๐
no you're fine!
you'll have to expand the Discount objects under https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-total_details-breakdown
from the CheckoutSession
to get the expanded Discounts which will have the relevant Coupon code used on that payment
yeah but on session, user can close the page and decide to not pay too right ?
But what would be the problem with that?
the problem is that, I want to know, which customer bought what, and which discount code he has used if there are any
I think this is something we can see on stripe dashboard
but we need this data on database, to use it with our power bi integration
But my colleague explained exactly how to get this. Then you said "but what if they close the page and don't pay" in which case it doesn't matter since they didn't pay
no no, for example, we have a few telemarketers, each has their own discount codes to promote to people,
On our database, we need to have, who bought what by which discount code.
When we create the checkoutsession, if I create an entry which says Alice used Bob's discount code. Then this is wrong, because she didn't payed yet.
by using the code, I mean, buying the product with, not just typing it to the page.
1/ Create a Checkout Session
2/ Redirect to Checkout
3/ Wait.
4/ Customer pays
5/ Look at the Session after they pay, check if they used a discount code
6/ done