Skip to content

Instantly share code, notes, and snippets.

@adamjstevenson
Created September 15, 2016 16:52
Show Gist options
  • Select an option

  • Save adamjstevenson/912698d8759bdd2ce6ba1ffa978b3279 to your computer and use it in GitHub Desktop.

Select an option

Save adamjstevenson/912698d8759bdd2ce6ba1ffa978b3279 to your computer and use it in GitHub Desktop.
List upcoming created transfers on a connected account
require 'stripe'
# Your platform's secret key
Stripe.api_key = "YOUR-API-KEY"
# List `transfer.created` events on the connected account
events = Stripe::Event.list({type: "transfer.created", limit: 100},{stripe_account: "acct_YourConnectedAccountID"})
# Iterate through each event
events.each do | event |
# Inspect each transfer, looking for created transfers with expected pay dates in the future
transfer = event.data.object
if transfer.date >= Time.now.to_i
# Format the date nicely
formatted_date = Time.at(transfer.date).getutc.strftime("%m/%d/%Y")
# Output the transfer id, amount, and expected deposit date
puts "#{transfer.id},#{transfer.amount},#{formatted_date}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment