Skip to content

Instantly share code, notes, and snippets.

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 iloveitaly/977e2a5b8c6dfd1691c8fbad60929331 to your computer and use it in GitHub Desktop.
Save iloveitaly/977e2a5b8c6dfd1691c8fbad60929331 to your computer and use it in GitHub Desktop.
# Author: Mike Bianco <mike@suitesync.io>
# Description: Copy the description field on a Stripe customer to the email field
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
Stripe.max_network_retries = 10
Stripe::Customer.list(limit: 100).auto_paging_each do |customer|
if (customer.email.nil? || customer.email.empty?) && !customer.description.nil? && !customer.description.empty?
puts "copying\t#{customer.id}"
customer.email = customer.description
customer.save
else
puts "skipping\t#{customer.id}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment