#alexesprit-plaid
1 messages ยท Page 1 of 1 (latest)
Hello! I need to dig into how to find this a bit more, but do you happen to have an example request that's giving you the bank_account_exists error?
Not sure if I understand your question correctly, but here are few examples:
btok_1KTVluBL0Insec3J8zdCjBHr # 1
btok_1KTVmBBL0Insec3JuBIXDxTa # 2
These tokens are received from Plaid and they represent the same bank account
# Imitate the initial bank account connection (using token #1)
curl https://api.stripe.com/v1/customers/cus_KRB2TwlmNx7rub/sources \
-u sk_test_XXX \
-d source=btok_1KTVluBL0Insec3J8zdCjBHr
{
"id": "ba_1KTVluBL0Insec3Jntplt0z4",
"object": "bank_account",
"account_holder_name": null,
"account_holder_type": null,
"account_type": null,
"bank_name": "STRIPE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_KRB2TwlmNx7rub",
"fingerprint": "CLu6bhRjVI6MuTwe",
"last4": "6789",
"metadata": {
},
"routing_number": "110000000",
"status": "verified"
}
# Imitate the same bank account reconnection (using token #2)
curl https://api.stripe.com/v1/customers/cus_KRB2TwlmNx7rub/sources \
-u sk_test_XXX \
-d source=btok_1KTVmBBL0Insec3JuBIXDxTa
{
"error": {
"code": "bank_account_exists",
"doc_url": "https://stripe.com/docs/error-codes/bank-account-exists",
"message": "A bank account with that routing number and account number already exists for this customer.",
"type": "invalid_request_error"
}
}
Alternatively, this can be achieved by using btok_us_verified as a source parameter in that requests.
Ideally I want to get the Stripe bank account ID somehow (ba_1KTVluBL0Insec3Jntplt0z4) that is actually exists.
๐ Thanks for all the additional info (that was exactly what I was asking for)
So there isn't an ideal way to do this, but the general idea would be that you after getting that error you could iterate through all of that customer's bank accounts and compare the fingreprint of the token (https://stripe.com/docs/api/tokens/object#token_object-bank_account-fingerprint) with the fingerprints of the bank accounts they already have attached (https://stripe.com/docs/api/customer_bank_accounts/object#customer_bank_account_object-fingerprint)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Wow, seems like it's what I was looking for. Thank you a lot for sharing the links!
๐ awesome! glad i could help