Created
September 15, 2016 16:52
-
-
Save adamjstevenson/912698d8759bdd2ce6ba1ffa978b3279 to your computer and use it in GitHub Desktop.
List upcoming created transfers 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' | |
| # 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