#roshe10_charge-events-for-balance-ttransaction
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/1366876664981622976
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- roshe10_code, 3 hours ago, 21 messages
Hi, you should be able to attain the balance transaction from the latest charge.
In this instance, since the latest charge does not expand automatically.. you would need to take the ch_ id and retrieve the Charge: https://docs.stripe.com/api/charges/retrieve to get the balance transaction
hi, I hope you read my previous thread with your colleague. The thing is that bt object is not immediately available if you listen for payment_intent.succeeded event, therefore we ended up listening for charge.updated event.
It's not about expanding/getting BT object right, but *when *to do that exactly, because it might be null for some time
I'm unable to read the previous thread.
You can listen to payment_intent.succeeded event, and then retrieve the latest charge to attain the txn
Can you share an example where that is not working?
here it is, so this worked for one-off payments, now for recurring I need alternative
Can you try getting the latest charge from that event, evt_3RJKp8GSblWe99ue3F6EOnXS and get the balance transaction?
latest_charge: "ch_3RJKp8GSblWe99ue3kqQfqA8",
yes, and I can get it now (like after few seconds/minutes), but at that very moment when we handle that event, the bt is not available as described in the previous thread
Can you try this flow with a new subscription and show me where you do not get the balance transaction after the payment succeeds?
There is a delay in populating balance_transaction. If you retrieve the Charge object now, do you get the balance_transaction in your code?
We generally recommend listening to charge.* related events to get the balance transaction information
I'm not sure you follow, or I don't understand something.
So this is recommendation from your colleague, and when I applied that change in my code, it works for one-off. Therefore, payment_intent.succeeded is not reliable enough to listen if we need BT object at that very moment, because of the delay. I just need safe alternative/equivalent event for recurring
Hi! Jumping in for my colleague. It's not that it's not reliable, but rather that it shouldn't be relied on. In this case you'll probably want to listen to the charge.succeeded and/or charge.updated events to get the Balance Transaction, as we explicitly state we may take up to an hour after the payment_intent.succeeded to emit the charge.updated event - but you'll likely also find it in the charge.created event as well.
okay, let me rephrase my question then. How come charge.x events didn't appear locally for recurring payment, even after the charge of this payment intent pi_3RJKp8GSblWe99ue3T3zpkzg is updated/created/succeeded ?
The charge.succeeded event for that Payment Intent was created: https://dashboard.stripe.com/test/events/evt_3RJKp8GSblWe99ue3V6ah2fL
...And delivered to a Stripe CLI instance as well.
ohh, okay, I think I get it now. At first, I thought I must listen only for charge.updated, but it could succeed immediately as well with BT object being already populated.
Absolutely, ya. So you likely want both of those events, and to handle them similarily.
I see, yeah that's how I understood, I need them both now charge.succeeded and charge.updated
thank you, I appreciate your support
You're very welcome! We're here if you run into any further roadblocks! ๐