【发布时间】:2014-02-26 08:53:41
【问题描述】:
在 Ruby on Rails 中使用 Stripe 的 API 我无法保存订阅。
我能够检索、更新和保存客户对象:
customer = Stripe::Customer.retrieve(some_customer_id) #this works
customer.save #this works
我还可以检索订阅: subscription=customer.subscriptions.retrieve("some_subscription_id") #这可行
但是,在尝试保存订阅时: subscription.save #这不起作用
我不断收到这个:
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'
尝试取消订阅时也是如此:
customer.subscriptions.retrieve("sub_3QM09lOz64QuSf").delete()
我明白了:
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'
没有这个,我不能让客户直接从网站取消。
我错过了什么?
【问题讨论】:
-
OK 使用 gem 'stripe', :git => 'github.com/stripe/stripe-ruby' 而不是 gem 'stripe' 似乎可以解决问题。
标签: ruby-on-rails ruby stripe-payments subscriptions