微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/ruby/264905.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐