#martin-bean_unexpected
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
đź”— 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/1211939843823763456
📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.
⏲️ 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. Thank you for your patience!
Screenshot showing payment_intent.succeeded arriving after all other charge, PaymentIntent, and checkout session-related webhooks. Why is this?
Note: these are webhooks sent to my application in its Connect webhook handler, for the connected account, as I’m creating a checkout session to perform a direct charge like this:
$stripe->checkout->sessions->create(
params: [
'amount' => 1000,
'currency' => 'gbp',
],
opts: [
'stripe_account' => 'acct_connected',
],
);
Hi there, webhooks are not guarnteed to arrive in the order of creation
Your endpoint shouldn’t expect delivery of these events in this order, and needs to handle delivery accordingly. You can also use the API to fetch any missing objects (for example, you can fetch the invoice, charge, and subscription objects using the information from invoice.paid if you happen to receive this event first).
@icy dock Well that’s quite frustrating given I want to mark an order as “processing” when a payment is processing, and “paid” when a payment is complete.
What’s the point of having webhooks to build an integration, if these webhooks are sent in an arbitrary fashion?
Can you share with me the ID of the checkout session?
It’s long gone. Give me a couple of minutes and I’ll generate a new one.
Although with that being said, I don’t receive checkout.session.created events from Connected accounts. Is that to be expected?
There's no such event called checkout.session.created
OK. These are the events I receive, and the order that I receive them in:
2024-02-27 08:03:53 --> connect charge.succeeded [evt_3OoLdjDFo4CC5L9L0jfC6E0p]
2024-02-27 08:03:53 <-- [200] POST http://localhost.cms.yourfightsite.com/stripe-connect/webhook [evt_3OoLdjDFo4CC5L9L0jfC6E0p]
2024-02-27 08:03:53 --> connect checkout.session.completed [evt_1OoLdlDFo4CC5L9LzhNamnIM]
2024-02-27 08:03:53 --> connect payment_intent.succeeded [evt_3OoLdjDFo4CC5L9L03jFJ498]
2024-02-27 08:03:53 --> connect payment_intent.created [evt_3OoLdjDFo4CC5L9L0bJLbbss]
2024-02-27 08:03:53 <-- [200] POST http://localhost.cms.yourfightsite.com/stripe-connect/webhook [evt_1OoLdlDFo4CC5L9LzhNamnIM]
2024-02-27 08:03:53 <-- [200] POST http://localhost.cms.yourfightsite.com/stripe-connect/webhook [evt_3OoLdjDFo4CC5L9L03jFJ498]
2024-02-27 08:03:53 <-- [200] POST http://localhost.cms.yourfightsite.com/stripe-connect/webhook [evt_3OoLdjDFo4CC5L9L0bJLbbss]
My account ID: acct_19XzXuDMMMbZqdzh
Connected account ID: acct_1OnqaYRaY6YKcFjW
Checkout session ID: cs_test_b1d8OEM8xZ4KFV66x0HqISGheqbSvOo5QkTYjAWN7Qbx272FHcqeAVUiX2
https://stripe.com/docs/api/events/types refer here for the complete list of events
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Well nonetheless, events and their order, and relevant IDs, are here: #1211939843823763456 message
Ok. I believe I have alreeady your question about the event sequence.
OK? But like I asked above, what’s the point of having webhooks to build an integration, if the webhooks are just sent whenever, and in whatever order?
How am I meant to mark as order as “processing” when a payment is processing, and then “complete” when a payment is complete, if they don’t arrive in that order?
You can also use the API to fetch any missing objects (for example, you can fetch the invoice, charge, and subscription objects using the information from invoice.paid if you happen to receive this event first).
Can I suggest you to use this?
This isn’t helpful. I want to update an order as part of a checkout process.
My order starts off as “open”.
I want it to be marked as “processing” when a payment for that order is processing.
I then want to mark it as “paid” when a payment is completed.
Isn’t this the entire point of receiving webhooks from a payment processor?
What’s the point of receiving a “created” webhook after the payment is all done?
If you check the timestamps of these events, you will find that they are all happening at the same.
And payment will only move to processing if they are asynchronous (i.e., ACH) otherwise it would go straight to succeeded or requires_payment_method
https://docs.stripe.com/payments/paymentintents/lifecycle you can learn more about payment intent lifecycle here
Again:
• I want to update my order as “processing” when creating the PaymentIntent is created.
• I want to update my order as “paid” when the PaymentIntent succeeds.
Right now, my orders are getting left as “processing” because the payment_intent.created webhook arrives after the payment_intent.succeeded webhook.
The thing is that the checkout wil create and confirm the PaymentIntent at the same time.