繁体   English   中英

在node.js中实现带条带的ach

[英]Implementing ach with stripe in node.js

我把客户的银行详细信息转换成令牌。基于该令牌,我创建了客户ID。接下来我需要执行verifySource。 但我在verifySource收到错误,错误是**

未处理的拒绝TypeError:无法读取未定义的属性'verifySource'**

** **这是我的代码是****

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应该是第二个参数(参见API参考 )。

尝试升级代码,如下所示:

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) {
  });
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM