#PeterJCLaw-refund-error
1 messages · Page 1 of 1 (latest)
Hey. Pasting your follow-up message here for context
've struggled to find much in Stripe's developer docs about how to handle these errors, however the general support docs suggest that refunds which hit this case are "pending" and may eventually go through.
Is that really expected? If so, how should API clients handle such errors if they need the details from the successful response?
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Indeed, there is an event you'd subscribe to to handle this: https://stripe.com/docs/refunds#failed-refunds
Aha, thanks.
Should that event (and the related refund) show up in the Stripe Dashboard?
They'll appear on the related Payment Intent page, yep
Presumably if I retry one of these refunds using the same idempotency key I'll get back the success response? (and no extra refund issued?)
Exactly yes, assuming within ~24 hours of initial request (we only store idempotency keys for 24 hours): https://stripe.com/docs/idempotency
But that's not really what they're intended for. They're intended to retry API requests following a 500 response
hrm
I'm struggling to work out how I'd otherwise align the data. The docs you linked about the webhook suggest that it's for failures from the user's bank, whereas this error appears to be a failure in creating the refund (in the Python API for example it's pretty much the same kind of error as you get if you try to refund a negative amount).
Importantly: we don't get back any id or anything to identify the refund, so matching that up with the webhook data would be a bit of a guessing game.
As a result, I think this behaving like a hard error (i.e: not doing a refund at all) and letting the client retry themselves feels like it might be easier to work with (though of course the client doesn't know when the problem will be resolved). Certainly this seems to be what I'm seeing here (none of the examples I've looked at where we've hit this show the refund subsequently being processed).
The docs you linked about the webhook suggest that it's for failures from the user's bank, whereas this error appears to be a failure in creating the refund (in the Python API for example it's pretty much the same kind of error as you get if you try to refund a negative amount).
You asked how to handle Refunds that instatus: 'pending', which can result in a rejection/failure from the bank. You'd use that event in those cases
Otherwise, yes. It's just an API error (400) and you'd throw an exception as per your normal logic
Ah, sorry. Perhaps I'm misunderstanding what https://support.stripe.com/questions/pending-refunds-due-to-insufficient-funds-or-stripe-balance implies then?
I'd read that as maybe being related to the API error I'm seeing, though perhaps that's a separate (if similarly termed) thing?
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
I am indeed seeing HTTP 400s with content
"error": {
"message": "Insufficient funds in your Stripe balance to refund this amount.",
"type": "invalid_request_error"
}
}
Just to check: is it the case that this won't have created a refund (and I should retry later)?
Yes, otherwise you would have received the Refund object will relevant status
thanks 🙂
Np!