#PeterJCLaw-refund-error

1 messages · Page 1 of 1 (latest)

lapis rampart
#

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?

night mesa
#

Aha, thanks.

#

Should that event (and the related refund) show up in the Stripe Dashboard?

lapis rampart
#

They'll appear on the related Payment Intent page, yep

night mesa
#

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?)

lapis rampart
#

But that's not really what they're intended for. They're intended to retry API requests following a 500 response

night mesa
#

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).

lapis rampart
#

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 in status: '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

night mesa
#

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?

#

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)?

lapis rampart
#

Yes, otherwise you would have received the Refund object will relevant status

night mesa
#

thanks 🙂

lapis rampart
#

Np!