Last active
December 15, 2017 13:00
-
-
Save adamjstevenson/bb635b0baca70a405f5a96e267ef2d29 to your computer and use it in GitHub Desktop.
Advanced decline report
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" | |
declines = Stripe::Charge.list(paid: false, limit: 100) | |
declines.auto_paging_each do |decline| | |
# Format the timestamp | |
formatted_date = Time.at(decline.created) | |
# Output the date, card id, brand, last 4, and decline message | |
puts "#{formatted_date},#{decline.id},#{decline.source.id},#{decline.source.brand},#{decline.source.last4},#{decline.failure_message}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment