【问题标题】:Unable to add credit card to a managed account on Stripe无法将信用卡添加到 Stripe 上的托管帐户
【发布时间】:2016-06-04 19:12:37
【问题描述】:

我正在使用Stripe managed accounts,我可以毫无问题地创建和检索帐户,但我无法将信用卡添加到任何 Stripe 帐户。我使用Stripe.js 处理卡片创建过程,所以在视图中我收集卡片字段并让 Stripe.js 完成验证和处理的繁琐工作。如果一切正常,我会收到来自 Stripe 的 stripeToken,它在我的控制器中用于最终关联托管帐户和信用卡。

但是我收到此错误:

Error creating card: (Status 400) You must provide a card that has the 'currency' field set when adding a card to a Stripe account.

因此我假设我需要在 Card 表单中添加 currency 字段,所以我再次尝试,然后出现此错误:

This card doesn't appear to be a debit card. (when submitting currency from views)

我已经尝试搜索错误,但不知何故没有真正的参考或以前的答案。

有谁知道我该如何解决这个问题?

提前致谢!


详情

由于我在本地机器上进行测试,所以我使用的是 Stripe 的测试卡号: 4242424242424242 接受任何 expiration dateCVC

这是一些代码:

这就是我创建管理帐户的方式:

def create_account(email)
  Stripe::Account.create(
    {
      :country => "US",
      :managed => true,
      :email => email,
      :default_currency => "USD"
    }
  )
end

这就是我将卡令牌添加到帐户的方式(基于API docs):

def add_card_to_account(account_id, card_token)
  account = get_account(account_id)
  account.external_accounts.create(:external_account => card_token)
end

【问题讨论】:

  • 您好,我遇到了同样的问题。你找到解决方案了吗?谢谢

标签: ruby-on-rails ruby stripe-payments credit-card


【解决方案1】:

Stripe accounts 是付款目的地 -- 他们可以接收资金,但不能提供资金。

Customers 是付款来源,即他们提供资金。)

目前,Stripe 账户可以使用两种不同类型的外部账户作为支付方式(即取回他们的资金):

  • 银行账户
  • 借记卡(仅限美国)

因此,您可以将借记卡作为外部账户添加到美国自定义账户,但不能添加信用卡,因为信用卡不能用于接收资金。

为了使用借记卡作为支付方式,卡token 必须已使用Stripe.js 使用currency 参数创建。由于目前这仅适用于美国帐户,因此currency 参数的值必须为"usd"。这是一个使用 currency 参数的 Stripe.js 表单的简单示例:https://jsfiddle.net/ywain/rprufyg5/

在测试模式下,您需要使用借记卡testing card numbers 之一,例如4000 0566 5566 55565200 8282 8282 8210

【讨论】:

  • 谢谢你,你可能为我节省了很多时间。
  • 使用 Stripe Elements 时,将货币参数添加到 create token 调用中。 stripe.createToken(card, { currency: 'usd' });
【解决方案2】:

我也有同样的问题。我已经联系了他们,我为我找到了一些解决方案。 我正在使用 iOS Stripe SDK 生成令牌。 它对我有用。

目前,Stripe 仅支持用于卡 external_accounts 的美国美元借记卡。您可以将货币参数添加到您的代币的方法是添加对

的直接调用
self.paymentTextField.cardParams.currency = @"usd"; 

在 PaymentViewController 中初始化 STPPaymentCardTextField 之后,如下所示:

// Setup payment view
STPPaymentCardTextField *paymentTextField = [[STPPaymentCardTextField alloc] init];
paymentTextField.delegate = self;
paymentTextField.cursorColor = [UIColor purpleColor];
self.paymentTextField = paymentTextField;
self.paymentTextField.cardParams.currency = @"usd";
[self.view addSubview:paymentTextField];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-23
    • 1970-01-01
    • 2012-08-08
    • 2017-11-05
    • 2016-05-02
    • 2020-06-18
    • 2017-04-20
    • 2021-07-23
    相关资源
    最近更新 更多