#nicolas-fernandez-falco_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/1238521007795343390
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Usually I'd expect it to go into a pending state first - do you have an example refund ID I can take a look at to see what's happening?
Yess
pyr_1PEsh9JAejluIz2U98tXkSM4
Now that I'm taking a look at the events of the invoice. Seems that the charge.refund event changed from require_action to pending
But that was not the original flow
The original flow was:
- Refund requested
- Charge.refund -> status -> require action event
- Charge.refund.updated -> status -> succeeded event
Backing up for a minute - the Payment Refund object you sent over was for a ACH/US Bank account payment. It doesn't seem to be related to bank transfers/cash balance
ohh maybe I sent another ID. Let me check
sorry
pyr_1PEdRvJAejluIz2ULBiCWJAx
Yeap. I was with the incorrect one. That's the correct one
Ah yeah the reason this went straight to succeeded is because of some discrepencies in how refunds behave in live vs test mode. In testmode we skip the pending because the refund succeeds/completes as soon as the bank account details are submitted (there is no real bank to talk to / wait on)
ohhh gotcha
So you are saying that in Live mode we would listen to the charge.refund.update with pending status and then charge.refund.update with the suceeded status?
yup!
And another question. Cause when it's with ACH for example the event that has the refund with pending status is through the charge.refunded event. For customer_balance would be charge.refunded? or charge.refund.update event triggered?
If you're doing a cash balance refund to the customer I believe it'll always start off with a status of requires_action in the charge.refunded event and the pending stastus will be reflected in a future charge.refund.updated event
Okay. Can you confirm that? Because it will change my implementation
We talk about it in our documentation so I'm fairly sure
Is there any way to really confirm that? Maybe talking with Stripe Support? Because I understand your point but I need to confirm that 100% sure hahah.
Is there a specific reason why you're coding your integration where it requires a specific state on refund creation? You could add branching logic to be able to handle the different states instead?
Just to be clear - I'm fairly sure that what I've said is correct, but there's always the chance that something breaks or there's some niche edge case I haven't thought of. You can check with support if you want to be 100% sure, but they may have a hard time giving you that guarantee as well
I'm 100% agree with you. The problem is how it's already implemented some of that stuff which is not the best practice haha. Basically, they are listening to the charge.refunded event and marking those refunds as refunded and in the charge.refund.update only doing something if it's a failed status undoing the refund.
What I'm going to do it's basically move to pending refund the charge.refunded event unless it has the succeeded status. And listen correctly to the charge. refund.update the event and mark that refund as refunded if the status is succeeded or undo the refund if the status is failed.
The person who implemented these webhooks didn't the correct way.
Gotcha - yeah I can totally sympathize with modifying code you didn't originally write.
I think you can safely assume you'll start off with a requires_action with cash balance refunds and then moving to pending and then succeeded (if you see otherwise in livemode it's likely a bug that you should raise to us)
Sounds good! Thanks for the information!
๐ I'm going to close out this thread now, but if anything else comes up fill out the form to start up a new thread
Awesome!