Skip to content

Instantly share code, notes, and snippets.

@erikpukinskis
Created February 27, 2015 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikpukinskis/42cbee4612eb61bcaf3f to your computer and use it in GitHub Desktop.
Save erikpukinskis/42cbee4612eb61bcaf3f to your computer and use it in GitHub Desktop.
require 'stripe'
Stripe.api_key = "yr key heer"
# This will cancel all of the subscriptions in your Stripe account. Money corrupts.
$start_at
$found_one = true
while $found_one
puts 'Batch after ' + ($start_at ? $start_at : 'no one')
$found_one = false
Stripe::Customer.all(starting_after: $start_at).each do |customer|
$found_one = true
if !!customer['subscription']
customer.subscription.delete
puts ' xxx cancelling ' + customer.subscription.id
else
puts ' ' + customer.id + ' has none'
end
$start_at = customer.id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment