Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting Chargify::Subscription::PaymentProfile #124

Open
shantanuthatte opened this issue Dec 18, 2015 · 1 comment
Open

Deleting Chargify::Subscription::PaymentProfile #124

shantanuthatte opened this issue Dec 18, 2015 · 1 comment

Comments

@shantanuthatte
Copy link

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
Copy link
Contributor

wsmoak commented Dec 18, 2015

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants