Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Stripe with Rails 4:此客户没有附加的付款来源_Javascript_Ruby_Ruby On Rails 4_Stripe Payments - Fatal编程技术网

Javascript Stripe with Rails 4:此客户没有附加的付款来源

Javascript Stripe with Rails 4:此客户没有附加的付款来源,javascript,ruby,ruby-on-rails-4,stripe-payments,Javascript,Ruby,Ruby On Rails 4,Stripe Payments,在rails 4中使用Stripe(测试模式)时,是否有人遇到过此错误:“此客户没有附加的支付源”?它会触发my 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)

在rails 4中使用Stripe(测试模式)时,是否有人遇到过此错误:“此客户没有附加的支付源”?它会触发my 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

请尝试以下代码:(只需替换“卡:条带卡\u令牌”=>“源:条带卡\u令牌”)


我不知道这个gem,但显然您试图创建的客户对象无效,请检查该对象的验证。@MohammadAbuShady它是我的user.js。我错过了一个
+
接线员!lol花了4小时才找到它。它现在起作用了!
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