I am trying to add bank details of a particular customer in stripe through nodejs but facing issue in sending the data.I was following the stripe documentation https://stripe.com/docs/api/customer_bank_accounts/create
In my case it is throwing below error:
Error: Received unknown parameters: account_holder_name, account_holder_type, customer
Hence if you could please help me resolve this issue.
please find below code:
app.post('/addbankaccountdetails', async function(req,res) {
const bankAccount = await stripe.customers.createSource(
'cus_M4zhLpZUB456Ef',
{
source: {
object: 'source',
account_holder_name: 'Rakesh Aggarwal',
account_holder_type: 'individual',
customer: 'cus_M4zhLpZUB456Ef'
}
}
);
res.status(200).send();
})
CodePudding user response:
These are the docs for the method you're trying to use: https://stripe.com/docs/api/cards/create?lang=node#create_card-source
The parameters you're trying to use aren't listed in the docs for that method.
CodePudding user response:
Here's a snippet to create a bank account for a customer using createSource()
:
const bankAccount = await stripe.customers.createSource('cus_xxx', {
bank_account: {
object: "bank_account",
account_holder_name: "Foo Bar",
account_holder_type: "individual",
account_number: "000123456789",
routing_number: "110000000",
country: "US",
currency: "usd",
}
});