【问题标题】:This customer has no attached payment source该客户没有附加付款来源
【发布时间】:2015-07-27 16:27:01
【问题描述】:

我不断收到客户没有附加付款来源的相同错误...
我不知道为什么会这样。

attr_accessor :stripe_card_token

  def save_with_payment
    if valid?
      customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token)
      self.stripe_customer_token = customer.id
      save!
    end
  end
end

【问题讨论】:

标签: ruby-on-rails


【解决方案1】:

看起来您已经为stripe card token 设置了attr_accessor,但您是否真正实现了条带文档https://stripe.com/docs/api/ruby#create_customer 中提到的令牌生成过程?

您可以查看https://stripe.com/docs/stripe.js 了解如何生成令牌。

【讨论】:

  • 我确实创建了一个 users.js 文件。我如何在这里上传?
  • 您应该使用该js将信用卡信息从js转换为令牌并传递给服务器,如stripe.com/docs/stripe.js所示。那么只有你可以使用customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token)中的令牌
猜你喜欢
  • 2018-12-13
  • 2018-07-28
  • 2016-05-22
  • 1970-01-01
  • 1970-01-01
  • 2017-03-13
  • 1970-01-01
  • 2020-12-14
  • 2019-01-26
相关资源
最近更新 更多