Has anyone experienced this error when using Stripe (test mode) with rails 4: "This customer has no attached payment source"? It triggers 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 have rechecked my form and my users.js and I see nothing wrong; spellings are perfect. My rails version is 4.2.0; ruby: 2.1.3p242
Please try the below code: (Just replace the "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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With