#taylorcooney_api

1 messages ยท Page 1 of 1 (latest)

spice parcelBOT
#

๐Ÿ‘‹ 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.

vocal mauve
#

Hi there

#

Oh wait this should be 4 levels...

#

Hmm looking

spice parcelBOT
thorn coral
#

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']})

carmine slate
#

hi there ๐Ÿ‘‹ - I'll be taking over for bismarck, who needed to step away

thorn coral
#

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']})

carmine slate
#

looking - sorry, the server is busy

thorn coral
#

Not a problem @carmine slate

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

thorn coral
#

Could you give me a concrete example of what that looks like?

carmine slate
#

Sure - let me get my reproduction finished

thorn coral
#

Great, @carmine slate...share that with me when you can

carmine slate
#

okay sorry this is more complicated than I remembered - nearly done

thorn coral
#

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

carmine slate
#

๐Ÿ˜‚

#

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

thorn coral
#

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?

carmine slate
#

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

thorn coral
#

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

carmine slate
#

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

thorn coral
#

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

carmine slate
#

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:

  1. list charges using Stripe-Account header on the connected account using something like created from the original PaymentIntent, expanding data.source_transfer to tie it to your PaymentIntent's latest_charge as well as data.refunds.balance_transactions