Javascript 在node.js中使用stripe实现ach
我获取了客户的银行详细信息并将其转换为令牌。根据该令牌,我创建了客户id。接下来我需要验证源代码。但我在verifySource得到错误,错误是 ** 未处理的拒绝类型错误:无法读取的属性“verifySource” 未定义** ****这是我的代码****Javascript 在node.js中使用stripe实现ach,javascript,node.js,stripe-payments,Javascript,Node.js,Stripe Payments,我获取了客户的银行详细信息并将其转换为令牌。根据该令牌,我创建了客户id。接下来我需要验证源代码。但我在verifySource得到错误,错误是 ** 未处理的拒绝类型错误:无法读取的属性“verifySource” 未定义** ****这是我的代码**** var stripe = require("stripe")("sk_test_73xfGiaFaZLWO8oVoNr8PqSe"); var tokenId = "btok_1BiIZkKB2GdGniJfVf8H0Yy0"; var d
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: "paying1.user@example.com",
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) {
});
});
请帮助我。验证源代码后,下一步要处理什么。
如何验证用户的银行帐户
谢谢,正如@Titus指出的,您的代码中有一个输入错误:
stripe.customer.verifySource
应该是stripe.customers.verifySource
此外,verifySource
需要银行账户ID(ba_…
),而不是银行账户令牌ID(btok_…
)。此外,客户ID应该是第一个参数,银行帐户ID应该是第二个参数(参见)
尝试如下方式升级代码:
stripe.customers.create({
email: "paying1.user@example.com",
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) {
});
});
您有一个输入错误,它应该是
stripe.customers
而不是stripe.customer
谢谢提图斯,错误已经解决。但是如果我需要查看结果输出。customer.sources.data[0].id,这一行什么操作performsIt返回作为客户付款来源添加的银行帐户的id。比照及