chargify/chargify_api_ares

Subscription Override Endpoint

Opened this issue · 2 comments

API Reference
https://reference.chargify.com/v1/subscriptions-override

Preferably with a method on the subscription object:

subscription.override(
  canceled_at: "2000-12-31",
  cancellation_message: "Original cancellation in 2000",
)

@blakeprudhomme I needed this too, and was able to achieve it by using built-in behavior in Rails ActiveResource. Just add the following code to your Chargify initializer.

# config/initializers/chargify.rb
module Chargify
  class Subscription < Base
    def override(fields)
      put(:override, subscription: fields)
    end
  end
end

Then you can use this new override method as you intended:

subscription = Chargify::Subscription.find('1234567')
subscription.override(activated_at: '2018-05-25')

Denis

@denisahearn Thanks for this work around!