Failed to save or unsubscribe with Stripe

Using the stripe API with Ruby on Rails I cannot save subscriptions.

I can retrieve and update and save client objects:

customer = Stripe::Customer.retrieve(some_customer_id) #this works customer.save #this works 

I can also get subscriptions: subscription = customer.subscriptions.retrieve ("some_subscription_id") #this works

However, when trying to save a subscription: subscribe.save # this does not work

I keep getting the following:

 NoMethodError: undefined method `save' for #<Stripe::StripeObject:0x007ff37147c720> from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/stripe- 1.9.9/lib/stripe/stripe_object.rb:158:in `method_missing' 

Similarly, when trying to unsubscribe:

 customer.subscriptions.retrieve("sub_3QM09lOz64QuSf").delete() 

I get:

 NoMethodError: undefined method `delete' for #<Stripe::StripeObject:0x007ff36d3f0d50> from /Users/me/.rvm/gems/ruby-2.0.0-p353/gems/stripe- 1.9.9/lib/stripe/stripe_object.rb:158:in `method_missing' 

Without this, I cannot allow customers to cancel directly from the site.

What am I missing?

+6
source share
1 answer

Update your last stone with bundle update stripe and try again. Subscriptions have been changed around 1.10.0 and require a version to save them. By configuring your gemfile to use your github repository, you are essentially using the latest version available during your package.

+9
source

All Articles