带 Rails 4 的条纹:此客户没有附加付款来源

Stripe with Rails 4: This customer has no attached payment source

有人在 rails 4: "This customer has no attached payment source" 中使用 Stripe(测试模式)时遇到过这个错误吗?它在我的 user.rb 模型中触发行 (customer = ):

attr_accessor :stripe_card_token

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

我重新检查了我的表格和我的 users.js,没有发现任何问题;拼写是完美的。我的 rails 版本是 4.2.0; ruby: 2.1.3p242

请尝试以下代码:(只需替换 "card: stripe_card_token" => "source: stripe_card_token")

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