Deleting Chargify::Subscription::PaymentProfile
Opened this issue · 1 comments
shantanuthatte commented
Hi,
I am unable to delete a Payment Profile, without deleting the subscription. The use-case is to remove the users card on file.
sub = Chargify::Subscription.find_by_customer_reference("test")
sub.payment_profile.destroy
=> DELETE https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
--> 404 Not Found 2916 (511.4ms)
Also, this fails too:
Chargify::PaymentProfile.find(sub.payment_profile.id).destroy
=> GET https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
--> 200 OK 770 (430.2ms)
DELETE https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
--> 404 Not Found 2916 (432.8ms)
I think, the path for delete is wrong and should be:
https://<subdomain>.chargify.com:443/subscriptions/<sub_id>/payment_profiles/<PP_id>.xml
wsmoak commented
The ability to delete a subscription's payment profile via the API was added to the docs fairly recently (in May). I suspect it just isn't supported yet in the gem.
Because it has to go through the subscription instead of deleting the payment profile directly, I think it would need to be a new method on the Subscription object. Thoughts? Naming suggestions? (That part always takes the longest!)