Load gem and set key.
require 'stripe'
Stripe.api_key = 'sk_live_xxxxx'
List customers.
json = Stripe::Customer.list(limit:10)
json["data"].each do |c|
puts c["id"].to_s+" "+c["description"].to_s+" "+c["email"].to_s
end
puts json["has_more"]
List all active subsucriptions for some products.
json = Stripe::Subscription.list(limit:100)
products = ["prod_xxxx","prod_yyyy","prod_zzzz"]
json["data"].each do |s|
prod = nil
s["items"]["data"].each do |si|
prod = si["price"]["product"] if products.include? si["price"]["product"]
end
next unless prod
c = Stripe::Customer.retrieve(s["customer"])
prod = Stripe::Product.retrieve(prod)
v = [c["name"],c["email"],s["status"],prod["name"]]
puts v.join(" ")
end