#mario_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1382302600187351102
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! taking a look at this now
ok - it does look like this is possible, but not particularly straightforward. give me a bit to try to synthesize it for you
- Retrieve the Charge and expand
balance_transaction, then inspect thecharge.balance_transactionavailable_onproperty. Usually that means that the charge will be paid out that day. - Call List Payouts with
arrival_date[gte]the value from theavailable_onfrom above andarrival_date[lte]a value from the next day to limit it to just payouts from between those days. this will usually include the payout for the charge in question
- from there you can call List all balance transactions and pass in the
payoutproperty to ensure that payout contains the balanced transaction you're looking for. - in rare cases (delayed payouts etc) you might need to repeat step 2 and 3 for subsequent days to ensure that you find the right payout
Thanks for the suggestion! Unfortunately, this approach won’t work reliably for me because I trigger payouts manually, sometimes only once a month. That means the available_on date of the balance transaction doesn’t necessarily correspond to the actual payout date, and multiple charges can accumulate before I initiate a payout. I'm looking for a way to directly identify which payout a specific charge or balance transaction was included in.
gotcha... i don't think we have a great way to support that specific pattern. you could iterate through payouts that happened after a given charge and check them all, but that's a little messy
if you need this info consistently i would probably just recommend tracking it on your end. if you use webhooks you can listen for the payout.created event, then retrieve all of the balance transactions associated with the payout (see step 3 above), and finally save the payout ID, charge ID and balance transaction to a database so you can query it on your end
and then you could also backfill by retrieving previously created payouts and doing the same thing
Yes, this is exactly what I need to do — I was just hoping there might be a simpler option 🙂
Thank you very much anyway, and have a great day!
yep, you too!