#mrelliot69
1 messages · Page 1 of 1 (latest)
hi, what's the question?
i want to know how i can catch this error on the try catch
Sources with the type of ach_credit_transfer must be chargeable to be used with a PaymentIntent. Make sure the Source has been correctly authorized and try again.
{
"error": {
"message": "The provided Source src_... has a status of pending. Sources with the type of ach_credit_transfer must be chargeable to be used with a PaymentIntent. Make sure the Source has been correctly authorized and try again.",
"request_log_url": "https://dashboard.stripe.com/logs/req_UUsuqFe32YAGxM?t=1676907614",
"type": "invalid_request_error"
}
}
well it's hard to catch that programmatically because unfortunately doesn't include a code in the error
so I would probably just use a generic catch block and handle it as a generic error
that is waht i currently have but i dont want the client to see that message .. wanted to personalize a more user friendly message
so we can know that we dont support ach on the sub
yeah unfortunately like I said, it's hard because we fail to set a code on that error
you could try to regex compare the message field to detect that specific error, but that would break if we change the string, so it's not great. But there's no great option.
you could also just avoid this entirely really. You can look at the status of the Source before calling that method, and just no attempt it if it's not chargeable. That's probably what I would do.
the problem is that because is a subscription charge, is getting the default source set on the customer
then yeah, not much you can do