chargify / chargify_api_ares

A Chargify API wrapper for Ruby using ActiveResource
http://chargify.com
MIT License
161 stars 95 forks source link

How do I delete a subscription and the customer on Chargify using this gem? #173

Open zackxu1 opened 4 years ago

zackxu1 commented 4 years ago

How can I use this gem to delete a subscription and the associated customer? When I call subscription.destroy, the subscription is cancelled. I would like to delete both the subscription and customer in Chargify. Is this supported? I don't see any examples in the code or in the rspec files. Thanks.

wsmoak commented 4 years ago

Chargify generally doesn't recommend deleting subscriptions in a live site because it removes all the historical transaction and activity records and changes prior analytics, etc. It can be manually done in the Admin UI if needed however.

If this is a test site, you can "Clear Site Data" and remove all the customers and subscriptions to start over.

I think it's been deemed too dangerous to have in the public gem code, but if you have a use case for really deleting individual subscriptions, write to support (or sales if you're not yet signed up) and ask about it.

zackxu1 commented 4 years ago

Thanks for your feedback. This is for automated testing. We would like to clean up after we run the tests by deleting the Chargify objects created during the tests.

Manually deleting the objects via the admin UI can be laborious. "Clear Site Data" is too extreme as this is our staging environment used by interactive users too.

Is there no workaround for this? What's the support contact email address?

Thank you.

wsmoak commented 4 years ago

You can write to support@chargify.com

I can't tell from your message how often these tests are run, but something like VCR might be helpful to decouple the tests from Chargify. https://github.com/vcr/vcr