#krista_webhooks

1 messages ¡ Page 1 of 1 (latest)

twilit atlasBOT
#

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

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

stray elkBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

warm walrus
#

That's a Checkout Session object. If you want the Balance Transaction, then you need to get the Payment Intent from the Checkout Session object and inspect its corresponding Charge object via latest_charge: https://docs.stripe.com/api/payment_intents/object#payment_intent_object-latest_charge

The Charge object will ultimately have the Balance Transaction on it

lime bane
#

yes we do that.

From the webhook, we query the payment intent, then the charge event and then the balance transaction (all in that order). When we first get the webhook, this fails to get the balance transaction from the charge event because its null.

If I click resend from the dashboard, it all works and we are able to get the balanace transaction event.

lime bane
#

Hello, are you still there?

warm walrus
#

Hi, sorry for the wait. Looking now

lime bane
#

Ok no rush at all! Just making sure we were still coneected. Thank you

warm walrus
#

So what are you actually doing? You're retrieving the Charge using the Charge ID on the Checkout Session's Payment Intent, yes?

lime bane
#

Correct

warm walrus
#

And that happens immediately after getting the checkout.session.completed event?

lime bane
#

Yes as soon as we get the webhook, we create the order on our end and then run this section of code

#

The line that fails when we get the webhook is balance_id = charge_event.get("balance_transaction") ... and thats because in the logs, I can see the charge event's balance_transaction is null.

The second time when I manually trigger the webhook to be resent, it does have the balance_transaction

warm walrus
#

Usually this happens because the Charge has been confirmed but hasn't yet resulted in money movement, so there is no corresponding Balance Transaction. You can get around this by listening for the charge.succeeded Event instead. Not sure if that helps your situation or not though.

lime bane
#

Hmmm ok I understand. For the charge.succeeded events, where do I subscribe to that? In the dashboard, I am only getting the checkout.session.completed events

warm walrus
lime bane
#

But the only event coming through is account updated checkout.session.compelted

warm walrus
#

It doesn't look like that webhook endpoint has charge.succeeded enabled. I only see these events:

checkout.session.expired
checkout.session.completed
account.updated

lime bane
#

how do i update that? I dont see that option on this secreen

warm walrus
#

You select the elipses menu at the top right and edit it to enable that event

lime bane
#

oh im an idiot sorry

#

thank you for your help. ill try working with teh charge.succeeded webhook.

warm walrus
#

No worries, we really don't surface that functionality especially well IMO. I had to check myself to make sure it was there

lime bane
#

Appreciate the help! Hope you had a great day

twilit atlasBOT