#bruuh_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/1239911863978823722
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
Hello!
if you use a 100% coupon code, then the amount is $0, so there won't be any PaymentIntent created.
can you clarify exactly what you are doing? using Checkout Session? Using a Subscipriton or an Invoice?
Ok so we have a feature in which we generate a checkout session.
Depending on what the user picks, the checkout has either one_time props, either subscription info.
TO do custom stuff on our end once an order happens, we are listening to the next events. As a note - we have to be sure that payment has been done and so on before doing some stuff, so we CAN'T listen to the "checkout.session.completed" event:
- if it's a subscription - we listen for for 'invoice.payment_succeeded' (since invoices get generated only on subscriptions). This works both for 0$ value (with 100% coupon code) or for more than 0 value
- If it's a one-off (one time) - we have been told to listen to 'payment_intent.succeeded' - since this is the only event telling us information about an one-off order. All works fine, until we use a 100% coupon code.
Question is - what should we listen for (in terms of event) so we makre sure we have a complete order, one-off, even if it's a 100% discount one?
Thanks
if you are using Checkout Session, then the recommendation is to listen to checkout.session.completed
that event will be sent even if there's a 100% discount
Yes, but does it:
- guarantee the order has been paid?
- how can I differentiate here if it's a one_time vs it's a subscription?
one payment_intent successed it was easy, as long as I was not having an "invoice" on the payment intent, I knew it's a one_time.
guarantee the order has been paid?
yes
how can I differentiate here if it's a one_time vs it's a subscription?
in the Checkout Session obejct, you can check ifmodeis set tosubscriptionsorpayment: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-mode
ok so the checkout success event gets triggered only if success pay?
and last question - can I add any metadata on the checkout session to be sent, like I can on the payment intent? because i have to have access to certain properties.
ok so the checkout success event gets triggered only if success pay?
exactly
an I add any metadata on the checkout session to be sent, like I can on the payment intent?
yes: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-metadata
Thank you
and am I right to say that 'invoice.payment_succeeded' gets triggered even if 100% discount?
on a subscription
correct
Thank you a lot.
happy to help ๐
Is 'shipping_details' the one telling me about the shipping entered on the checkout?
Which prop tells me about the 'phone' added?
Also, which property tells me the "customer" id so I can fetch the customer from stripe?
address, phone, and everything like that should be here: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-customer_details
Also, which property tells me the "customer" id so I can fetch the customer from stripe?
customer
Ok but shipping is being entered at checkout time - so shouldn't that be in the "shipping_details" ?