Stripe with Rails 4: This client does not have a connected payment source

Has anyone experienced this error while using Stripe (test mode) with rails 4: "This client does not have a connected payment source"? It runs the line (customer =) in my user.rb model:

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 

I double-checked my form and my users.js, and I see nothing wrong; the spelling is perfect. My rails version is 4.2.0; ruby: 2.1.3p242

+5
source share
1 answer

Please try the code below: (Just replace "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 
+3
source

Source: https://habr.com/ru/post/1213874/


All Articles