Using stripe's API with Ruby on Rails I am unable to save subscriptions.
I am able to retrieve and update and save customer objects:
customer = Stripe::Customer.retrieve(some_customer_id) #this works
customer.save #this works
I am also able to retrieve subscriptions: subscription=customer.subscriptions.retrieve("some_subscription_id") #this works
However, when trying to save a subscription: subscription.save #this doesn't work
I keep getting this:
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 cancel a subscription:
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 am not able to allow customers to cancel directly from the site.
What am I missing?
If a payment fails for a subscription invoice, your customers can use the Stripe-hosted page to: View the details and amounts for the failed invoice and the associated subscription. Add a new card payment method for their subscription for the payment that's due and for future subscription payments.
The subscription remains in status incomplete and the invoice is open during this time. If your customer pays the invoice, the subscription updates to active and the invoice to paid . If they don't make a payment, the subscription updates to incomplete_expired and the invoice becomes void .
You can create or update a subscription using the Stripe Dashboard or the Stripe API. When creating a subscription, you can start immediately or schedule the subscription to start later.
Upgrade to their latest gem with bundle update stripe
and try again. Subscriptions were changed sometime around 1.10.0 and requires a version after that to save them. By configuring your gemfile to use their github repository you're essentially using the latest version available at the time of your bundle.
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