【问题标题】:unable to save or cancel subscriptions using Stripe无法使用 Stripe 保存或取消订阅
【发布时间】: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'

没有这个,我不能让客户直接从网站取消。

我错过了什么?

【问题讨论】:

标签: ruby-on-rails ruby stripe-payments subscriptions


【解决方案1】:

使用bundle update stripe 升级到他们最新的 gem,然后重试。订阅在 1.10.0 左右的某个时候发生了更改,并且需要在此之后的版本来保存它们。通过将 gemfile 配置为使用他们的 github 存储库,您实际上是在使用捆绑时可用的最新版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-24
    • 2018-09-01
    相关资源
    最近更新 更多