Reputation: 637
I took the customers bank details and converted into token .Based on that token I created the customer id .Next I need to do the verifySource . but I am getting error at verifySource , error is **
Unhandled rejection TypeError: Cannot read property 'verifySource' of undefined**
** **Here is My code is****
var stripe = require("stripe")("sk_test_73xfGiaFaZLWO8oVoNr8PqSe");
var tokenId = "btok_1BiIZkKB2GdGniJfVf8H0Yy0";
var data = {amounts: [32,45]}
// Token is created using Stripe.js or Checkout!
// Get the payment token ID submitted by the form:
//var token = request.body.stripeToken; // Using Express
// Create a Customer:
stripe.customers.create({
email: "[email protected]",
source: tokenId,
}).then(function(customer) {
// YOUR CODE: Save the customer ID and other info in a database for later.
stripe.customer.verifySource(
tokenId,
customer.id,
{
amounts: [32,45]
},
function(err, bankAccount) {
});
});
Please help me out .After verifySource what is the next step to process. How to verify the user bank accounts
Thanks
Upvotes: 3
Views: 1080
Reputation: 17503
As @Titus pointed out, you have a typo in your code: stripe.customer.verifySource
should be stripe.customers.verifySource
instead.
Additionally, verifySource
expects a bank account ID (ba_...
), not a bank account token ID (btok_...
). Also the customer ID should be the first argument and the bank account ID should be the second argument (cf. the API reference).
Try upgrading your code like this:
stripe.customers.create({
email: "[email protected]",
source: tokenId,
}).then(function(customer) {
// YOUR CODE: Save the customer ID and other info in a database for later.
stripe.customers.verifySource(
customer.id,
customer.sources.data[0].id,
{
amounts: [32, 45]
}
).then(function(bankAccount) {
});
});
Upvotes: 4