Open rscardinho opened 6 years ago
@rscardinho we ran into this issue as well when we wanted to allow our subscribers to add and/or switch between multiple payment methods. Currently we are accomplishing it like this...
module Chargify
class SubscriptionPaymentProfile < Base
set_prefix "/subscriptions/:subscription_id/"
self.collection_name = "payment_profiles"
include ResponseHelper
def change_payment_profile
post :change_payment_profile
end
end
end
def update_default_payment_profile(payment_profile_id)
sub = Chargify::Subscription.find(sub_id)
pp = Chargify::SubscriptionPaymentProfile.new
pp.id = payment_profile_id
pp.prefix_options = { subscription_id: sub.id }
pp.instance_variable_set(:@persisted, true)
pp.change_payment_profile
end
Hey,
In the platform that I'm working on, I got blocked (for a short period) because this gem doesn't support the
change_payment_profile
endpoint add by July 2016.I was thinking about adding support for the endpoint and using it like this:
Any suggestions?
API reference https://reference.chargify.com/v1/subscriptions/cancel-subscription-remove-delayed-method#change-default-payment-profile