Stripe create Token bank account

Viewed 492

I'm trying to add a token to create a bank account with stripe.

tokenAccount: async (req, res) => {
    Serveur.findOne({ _id: req.user._id }, async (err, user) => {
      try {
        await stripe.tokens.create({
          bank_account: {
            country: req.body.country,
            currency: req.body.currency,
            account_number: req.body.account_number,
            routing_number: req.body.routing_number,
          },
        });
      } catch (error) {
        return res.status("402").send({ error: { message: error.message } });
      }
    });
  },

and when i test the back end with postman with a "test" bank details from stripe i have this error :

{
    "error": {
        "message": "You cannot use a live bank account number when making transfers or debits in test mode"
    }
}

Which is weird because i used the test stripe's bank details. Do you have any idea what the problem could be ???

1 Answers

Each Stripe account offers both live and test keys. When you use their fake test accounts (for banks, MasterCards, and the like) you must also use their test keys. Don't try to use the live keys for testing; and, honestly, be happy they caught this for you.

Related