无法将信用卡添加到Stripe上的托管帐户

mcK*_*ain 10 ruby ruby-on-rails credit-card stripe-payments

我正在使用Stripe管理帐户,我可以毫无问题地创建和检索帐户,但我无法将信用卡添加到任何条带帐户.我正在Stripe.js处理卡创建过程,所以在视图中我收集卡片字段,让Stripe.js做验证和处理的脏工作.如果一切正常,我会stripeToken从我的控制器中使用Stripe 收到最终将管理帐户和信用卡关联起来.

但是我收到此错误:

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

因此我假设我需要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
Run Code Online (Sandbox Code Playgroud)

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

def add_card_to_account(account_id, card_token)
  account = get_account(account_id)
  account.external_accounts.create(:external_account => card_token)
end
Run Code Online (Sandbox Code Playgroud)

Ywa*_*ain 16

条纹帐户是付款目的地 - 他们可以接收资金,但不提供资金.

(客户是支付来源,即他们提供资金.)

目前,Stripe帐户可以使用两种不同类型的外部帐户作为支付方式(即检索其资金):

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

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

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

在测试模式下,您需要使用其中一个借记卡测试卡号,例如4000 0566 5566 55565200 8282 8282 8210.