#jfeezy9997-payout-for-pi
1 messages · Page 1 of 1 (latest)
Hey there @stuck ibex it is possible if you use automatic payouts, but indirect
ie, you cannot go directly from a payment intent id to a payout ID
what's the path?
Pulling that together for you now, bear with me
Alrighty. Here goes.
To find the payout, you first need to know when (what day) the expected payout will be, which you figure out looking at the PI's latest_charge.balance_transaction.available_on via expansion:
https://stripe.com/docs/expand
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-latest_charge
https://stripe.com/docs/api/charges/object#charge_object-balance_transaction
https://stripe.com/docs/api/balance_transactions/object#balance_transaction_object-available_on
This gives you a timestamp that is midnight UTC of the day the funds are going to be available, which is the day you'd expect the automatic payout
You then take that day and List payouts filtered by created with gte the available_on day you found and lte the next day:
https://stripe.com/docs/api/payouts/list#list_payouts-created
You might get multiple Payouts
Whether one or more, you can then List balance transactions by payout ID: https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout
And you'd be looking to match a balance transaction ID in that result to the one from the charge you originally expanded, and that payout id is the one you're looking for