Reputation: 19312
I'm trying to allow a user to add a credit card in my app using Stripe. When i call the code below (which is from the docs: https://stripe.com/docs/api#create_card), I get the error below.
Are the docs out of date or am i doing something wrong?
@card = Stripe::Customer.retrieve(current_account.stripe_id).cards.create(:card => params[:stripeToken])
undefined method `create' for #<Stripe::ListObject:...
Upvotes: 4
Views: 1723
Reputation: 4264
I solved this by replacing: gem "stripe" in my gemfile with: gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby', and then running bundle. It was working fine, and then out of nowhere threw this error, but updating seemed to fix it.
Upvotes: 2
Reputation: 3394
Support for creating a card was added in version 1.8.4 of the Stripe gem. You'll need to make sure you're using that version or newer, otherwise you'll see that error.
Upvotes: 6