Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# Description: close any open invoices on a customer
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
customer = Stripe::Customer.retrieve('cus_123') do |invoice|
if !invoice.closed
# NOTE you can also mark as invoice as forgiven: `invoice.forgiven = true`
invoice.closed = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment