#mark-reckard_webhooks
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/1367936525257543791
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, that is right. In production, it will take days but in test mode, these will take place much sooner. As for event ordering, Stripe does not guarantee event ordering: https://docs.stripe.com/webhooks#event-ordering
ok gotcha. So in production, when we submit a refund for a BACS payment, the refund will exist in pending status. it might take days for the charge to succeed like normal, but then when it does, the refund will process and the update the status to succeeded.
Also when the original payment fails, the docs indicate that the refund will be marked as cancelled. Does that emit a refund.updated event as well, or refund.failed, or some other event?
Yes, the document you found will have the details on how it works: https://docs.stripe.com/payments/payment-methods/bacs-debit#refunds
If the original payment fails, how would you event start a refund? I do not think you could create a refund in that case.
For asynchronous payments, we can initiate a refund in pending state while the initial charge itself is pending.
you can see an example at the payment intent i linked pi_3RJySOCMpnBh61hX0V5q23b8
For US Bank Accounts you might be able to, https://docs.stripe.com/payments/paymentintents/lifecycle?intent=payment cancel it while in 'processing' status
That example shows that the payment succeeded, and then you refunded it
That will be helpful information when we expand into US Bank accounts, but for now we're focusing on BACS specifically. I'm wondering about the event emitted when the original payment fails because we've already surfaced a bug in this Discord around that behavior. When a payment should be destined to fail in test mode, if you issue a refund it transitions the payment to successful unexpectedly.
The example I shared shows that we initiated a refund when the payment was pending
I would have expected the the payment to fail and you get 'payment_failed': https://docs.stripe.com/payments/payment-intents/verifying-status
It looks like what my teammate shared is a quick in test mode behavior.
Ok. So it seems like instead of being able to rely on test mode in this case, we'll just need to test payments and refunds with real money in production to confirm which events are fired when a payment fails and a refund is pending on that payment?
On this payment method, you should not be able to create a refund cancel as the payment is in 'pending' status. When the payment fails, you would get 'payment_failed' event.
Hmm, that's not how we've read this:
Refunds are processed only after the payment process is complete. If you create a full or partial refund on a payment that hasn’t completed yet, the refund process starts when the Charge object’s status transitions to succeeded. If the Charge object’s status transitions to failed, the full or partial refund is marked as canceled because the money was never debited from the customer’s bank account.
And that's also not how the API has behaved. We've been able to initiate refunds on pending payments. It sounds like a refund can be created on pending payment, but that the process starts when the charge succeeds, which is all pretty much what we've seen in test mode for success. But for failure, the refund will exist still and it will "be marked as cancelled", which I assume will change its status, so maybe we'll just listen to therefund.failedevent.
I might be remembering some other edge case then. Let me confirm this .
Thank you!
Ohhh, I'm mis-remembering and getting the Cancel call confused with the refunds: https://docs.stripe.com/api/payment_intents/cancel
Sorry about the confusion, you're right