0
votes

I get the error:

You cannot delete the default external account for your default currency. Please make another external account the default using the default_for_currency param, and then delete this one.

err1 StripeInvalidRequestError: You cannot delete the default external account for your default currency. Please make another external account the default using the default_for_currency param, and then delete this one. at Function.generate (/var/www/html/SageRider/node_modules/stripe/lib/Error.js:38:16) at IncomingMessage. (/var/www/html/SageRider/node_modules/stripe/lib/StripeResource.js:175:33) at Object.onceWrapper (events.js:299:28) at IncomingMessage.emit (events.js:215:7) at endReadableNT (_stream_readable.js:1199:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { type: 'StripeInvalidRequestError', raw: { message: 'You cannot delete the default external account for your default currency. Please make another external account the default using the default_for_currency param, and then delete this one.', type: 'invalid_request_error', headers: { server: 'nginx', date: 'Thu, 25 Jun 2020 19:28:55 GMT', 'content-type': 'application/json', 'content-length': '264', connection: 'keep-alive', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET, POST, HEAD, OPTIONS, DELETE', 'access-control-allow-origin': '*', 'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required', 'access-control-max-age': '300', 'cache-control': 'no-cache, no-store', 'request-id': 'req_bXINneBUbmPyo2', 'stripe-account': 'acct_1GwmPSFNjTTd70ro', 'stripe-version': '2019-12-03', 'strict-transport-security': 'max-age=31556926; includeSubDomains; preload' }, statusCode: 400, requestId: 'req_bXINneBUbmPyo2' }, rawType: 'invalid_request_error', code: undefined, param: undefined, detail: undefined, headers: { server: 'nginx', date: 'Thu, 25 Jun 2020 19:28:55 GMT', 'content-type': 'application/json',

The code I use is:

 stripe.accounts.deleteExternalAccount(
        cryptr.decrypt(data[0].accountId),
        cryptr.decrypt(data[0].bankAccountId),
        function(err, confirmation) {
          if(err) {
            console.log("err1",err)

              callback(err, false)
          }else {
                console.log("confirmation",confirmation)

                callback(false, true)
              }
1

1 Answers

2
votes

Today, you can not remove the last external account saved on a Custom account in the API. Stripe requires that an account always has a valid bank account for the currency once you've added this.

My guess is that this is the error you are getting right now though you didn't share the exact message. In that case, you need to change your code to stop removing the last external account or replace it by a new external account instead.