簡體   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