#taylorcooney_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/1435745985128169635
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
You can only expand 4 levels (see: https://docs.stripe.com/api/expanding_objects?api-version=2025-10-29.preview&rds=1)
Oh wait this should be 4 levels...
Hmm looking
Okay yeah instead you need to retrieve the destination_payment.application_fee and expand its refunds.data.balance_transaction: https://docs.stripe.com/api/application_fees/object?api-version=2025-10-29.preview&rds=1#application_fee_object-refunds-data-balance_transaction
Sorry, could you clarify that for me? Right now we are retrieving the payment intent like so , Stripe::PaymentIntent.retrieve({id: object.id, expand: ['charges.data.balance_transaction', 'latest_charge.transfer.destination_payment.balance_transaction']})
hi there ๐ - I'll be taking over for bismarck, who needed to step away
No worries, feel free to take a minute to get caught up
Just trying to figure out how to expand our webhook logic to handle for these cases. Right now we are retrieving the payment intent like so , Stripe::PaymentIntent.retrieve({id: object.id, expand: ['charges.data.balance_transaction', 'latest_charge.transfer.destination_payment.balance_transaction']})
looking - sorry, the server is busy
Not a problem @carmine slate
okay I think what bismarck was suggesting was to actually retrieve the destination payment on the connected account using the stripe_account header
Could you give me a concrete example of what that looks like?
Sure - let me get my reproduction finished
Great, @carmine slate...share that with me when you can
okay sorry this is more complicated than I remembered - nearly done
Yeah I am pretty stumped. I tried to retrieve the application fee that is listed in the latest charge destination payment and expand the refunds, but that does not match txn_1SN8BI4J9Qo7jZ8Va5meYmqa
Almost regretting turning on ACSS debits
๐
Okay, so
The core issue is really 'how do I find the balance transaction of the charge on my destination account so I can look at its balance transaction', right?
to which the answer is the source_transfer property on the Charge
there's a payment.created event that will include this if you listen for it on your connect webhook endpoint
This is what we currently are doing, Stripe::PaymentIntent.retrieve({id: "pi_3SKnbpKYTiCt9KzS0lLh2ive", expand: ['charges.data.balance_transaction', 'latest_charge.transfer.destination_payment.balance_transaction']})
Based on that specific payment intent ID, and me needing to locate txn_1SN8BI4J9Qo7jZ8Va5meYmqa, can you provide an example of how I retrieve this based on what you're saying?
Ok, so I think you have to list charges on the connected account using something you already know like the date/time of the original and then look at source_transaction to find the right one by matching its source_transfer.source_transaction to the original charge. Then you can retrieve that charge (also using Stripe-Account: 'acct-123') and you can expand the balance transaction
Can you provide a code example of how I retrieve this based on what you're saying?
I'm not quite following, and it sounds overally difficult based on what you're describing
I'm amazed that this isn't straight forward
Yeah, I think you're meant to use webhooks to know this in the first place. Going forward, it would probably be helpful to listen to payment.created in your connect webhook endpoint. When you process that event, you'll have the id of the destination charge and the original charge, so you could update that Charge and set the destination payment/charge on it as metadata
Is it possible to retrieve txn_1SN8BI4J9Qo7jZ8Va5meYmqa from pi_3SKnbpKYTiCt9KzS0lLh2ive? That is my core question and I feel like we haven't really answered that yet
Not in one step. I think you have to identify the payment on the connected account and then retrieve it and expand refunds.data.balance_transaction
I can't do a code sample right now but the steps would be:
- list charges using Stripe-Account header on the connected account using something like created from the original PaymentIntent, expanding
data.source_transferto tie it to your PaymentIntent's latest_charge as well asdata.refunds.balance_transactions