Last active
December 15, 2017 13:03
-
-
Save adamjstevenson/a58c302d4c77dc688dbb2d826488e14e to your computer and use it in GitHub Desktop.
List charges on a connected account
This file contains hidden or 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
require 'stripe' | |
Stripe.api_key = "YOUR-API-KEY" | |
# Authenticate as the connected account and retrieve the first 100 charges | |
charges = Stripe::Charge.all({limit: 100},{stripe_account: "acct_YourConnectedAccountID"}) | |
# Iterate through charges using auto-pagination | |
charges.auto_paging_each do |charge| | |
# Output the charge ID, amount, currency, refund, and dispute status | |
charge.dispute ? dispute = charge.dispute.id : dispute = "none" | |
puts "#{charge.id},#{charge.amount},#{charge.currency},#{charge.refunded},#{dispute}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment