My integration made a request to POST /v1/transfers and get back this response:
{
"error": {
"code": "insufficient_capabilities_for_transfer",
"message": "Your destination account needs to have at least one of the following capabilities enabled: transfers, crypto_transfers, legacy_payments",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_cyVXKUT1GV30oN?t=1731361723",
"type": "invalid_request_error"
}
}
This causes the async-stripe library to return a StripeError::JSONSerialization instead of StripeError::Stripe.
To Reproduce
Create a connected account, but don't give it the transfers capability. I think not doing the onboarding for the connected account will also not give it any capabilities.
Create a transfer to that connected account
Receive error from Stripe
Library fails to parse error.
Expected behavior
It should parse the error correctly and return the right type of error. Preferably, I think the ErrorCode enum should have an Unknown(String) variant so that cases like this can be worked around by users without an crate update.
Describe the bug
My integration made a request to
POST /v1/transfers
and get back this response:This causes the async-stripe library to return a
StripeError::JSONSerialization
instead ofStripeError::Stripe
.To Reproduce
transfers
capability. I think not doing the onboarding for the connected account will also not give it any capabilities.Expected behavior
It should parse the error correctly and return the right type of error. Preferably, I think the
ErrorCode
enum should have anUnknown(String)
variant so that cases like this can be worked around by users without an crate update.Code snippets
No response
OS
linux, ubuntu 20.04
Rust version
1.82
Library version
async-stripe 0.39.1
API version
2023-10-16
Additional context
Directly related to: #384
I'm willing to contribute a fix for this.