Created
July 5, 2017 23:22
-
-
Save iloveitaly/977e2a5b8c6dfd1691c8fbad60929331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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