ruby-on-rails – 无法使用Stripe保存或取消订阅

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法使用Stripe保存或取消订阅前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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”)#this works

但是,在尝试保存订阅时:
subscription.save #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'

同样在尝试取消订阅时:

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'

没有这个,我无法让客户直接从网站取消.

我错过了什么?

解决方法

使用捆绑更新条带升级到最新的gem,然后重试.订阅在1.10.0附近有所改变,之后需要一个版本来保存它们.通过将gemfile配置为使用其github存储库,您实际上使用的是捆绑时可用的最新版本.
原文链接:https://www.f2er.com/ruby/264905.html

猜你在找的Ruby相关文章