#bruuh_api

1 messages ยท Page 1 of 1 (latest)

high matrixBOT
#

๐Ÿ‘‹ 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.

spiral perch
#

hi there!

proven owl
#

Hello!

spiral perch
#

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?

proven owl
#

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

spiral perch
#

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

proven owl
#

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.

spiral perch
proven owl
#

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.

spiral perch
#

ok so the checkout success event gets triggered only if success pay?
exactly

proven owl
#

Thank you

#

and am I right to say that 'invoice.payment_succeeded' gets triggered even if 100% discount?

#

on a subscription

spiral perch
#

correct

proven owl
#

Thank you a lot.

spiral perch
#

happy to help ๐Ÿ™‚

proven owl
#

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?

spiral perch
#

Also, which property tells me the "customer" id so I can fetch the customer from stripe?
customer

proven owl
#

Ok but shipping is being entered at checkout time - so shouldn't that be in the "shipping_details" ?

spiral perch
#

yes shipping is in shipping_details.

#

I recommend doing some tests in test mode to see how all of this works