加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:16:08 所属栏目:百科 来源:网络整理
导读:在 Ruby on Rails中使用stripe的API我无法保存订阅. 我能够检索并更新和保存客户对象: customer = Stripe::Customer.retrieve(some_customer_id) #this workscustomer.save #this works 我也能够检索订阅: subscription = customer.subscriptions.retrieve
在 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存储库,您实际上使用的是捆绑时可用的最新版本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读