【问题标题】:ACH Stripe Bank Account VerificationACH Stripe 银行账户验证
【发布时间】:2017-12-20 15:06:51
【问题描述】:

我正在尝试使用 Stripe 验证银行帐户。 Stripe 文档中最接近的语言是 Node.js,所以我的代码有点不同,但问题是从 stripe.js 创建的条带对象上没有“客户”对象。

他们的代码(https://stripe.com/docs/ach#manually-collecting-and-verifying-bank-accounts):

// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("my_secret_key");

var data = {amounts: [32,45]}
stripe.customers.verifySource(
  'customer_id',
  'bank_account_id',
  {
    amounts: [32, 45]
  },
  function(err, bankAccount) {

});

我的代码:

<script src="https://js.stripe.com/v3/"></script>
<script>
    $('input').on('keydown', function (e) {
        if (e.which == 13) {
            $('#VerificationAmounts').submit();
        }
    });

    $('#VerificationAmounts').submit(function (e) {
        e.preventDefault();
        var stripe = Stripe("@publishKey");

        var data = { amounts: [$('#Amount1').val(), $('#Amount2').val()] }
        debugger;
        stripe.customers.verifySource(
          '@customerId',
          '@bankAccount.Id',
          data,
          function (err, bankAccount) {

          });
    });
</script>

错误:

Uncaught TypeError: Cannot read property 'verifySource' of undefined

有谁知道让“客户”对象填充到条带对象上的方法?

【问题讨论】:

  • 您正在尝试使用客户端库执行服务器端操作,它不起作用。
  • 感谢您为我指明正确的方向@Alex!

标签: javascript jquery model-view-controller stripe-payments


【解决方案1】:

根据@Alex 的评论,我试图使用 stripe.js 来验证银行帐户,但我应该使用 Stripe API。由于我使用的是C# MVC,因此我需要将客户提供给我的控制器的小额支付金额传递给我的控制器,并根据文档调用Stripe.netBankAccountServiceVerfiy 方法:https://github.com/stripe/stripe-dotnet

【讨论】:

    猜你喜欢
    • 2019-10-26
    • 1970-01-01
    • 2019-08-22
    • 1970-01-01
    • 1970-01-01
    • 2021-03-06
    • 2016-07-18
    • 2019-06-15
    • 1970-01-01
    相关资源
    最近更新 更多