#phal0r_unexpected

1 messages ยท Page 1 of 1 (latest)

brisk stormBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

๐Ÿ”— 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/1212735404357451777

๐Ÿ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

โฒ๏ธ 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. Thank you for your patience!

neat laurelBOT
agile harbor
#

Hi @old oyster ,
if you need further information or code samples, let me know.

old oyster
#

Hi
Yes you can't update a payment_intent's transfer_group created by an invoice

#

You can proceed and create a transfer by referencing the PaymentIntent without the need of the transfer_group

agile harbor
#

You can proceed and create a transfer by referencing the PaymentIntent without the need of the transfer_group
you mean by using the source_transaction property?

old oyster
#

yes

agile harbor
#

ok, that's what we are doing already

#

we use invoice.charge and assign it as source_transaction in the transfers

#

What do we lose if we remove transfer_group entirely?

#

According to the docs, it is not really necessary, but I am not entirely sure about the implications

old oyster
#

Yes it's not mandatory, it's a way for regrouping transfers

agile harbor
#

Can we still identify, to wich payment the transfers belong without the tranfser_group?

old oyster
#

Yes using the source_transaction

agile harbor
#

we tried this and faced a new error

#

same flow:

  • create invoice
  • create 2 transfers using invoice.charge, but the charge is undefined at this point

What is needed to have the correct charge?

neat laurelBOT
old oyster
agile harbor
#

one sec

quartz harness
#

๐Ÿ‘‹ taking over for my colleague. let me know when you have the request ID

agile harbor
#

ok, thanks

#

sorry for the delay

#

this is such an event: evt_1Op9BcGMzVvXT46ZZsMsXMzP

#

is this the id you need?

quartz harness
#

use the invoice.payment_intent.latest_charge

#

but this means you need to either retrieve the payment_intent or better retrieve the invoice and expand on payment_intent

agile harbor
#

I guess the latest_charge is set, when a payment is tried, right?

quartz harness
#

yes

#

that's why you need to wait until invoice.paid event

#

to create the transfers

agile harbor
#

maybe the big picture right now is important:

  • create the invoice and finalize it (with mode send_invoice)
  • we create the transfers
  • we return the clientSecret to the frontend
  • frontend uses it to for PaymentElement
  • user proceeds with payment
#

ah okay, that's what I wanted to discuss

#

so we are creating the transfers to early?

neat laurelBOT
pine thunder
#

๐Ÿ‘‹ stepping in

agile harbor
#

ok

#

can you answer my last question?

pine thunder
#

Yep was catching up and helping a few other folks

#

Finishing up taking a look now

#

One sec

agile harbor
#

thanks, take your time

pine thunder
#

So yeah, you basically can't use transfer_group here since this is a PaymentIntent from an Invoice and in that case you can't update trasnfer_group. Instead, you would want to use metadata here to tie the PaymentIntent and Transfers together.

agile harbor
#

this was the beginning of the convo

#

when we consider this flow:
maybe the big picture right now is important:

  • create the invoice and finalize it (with mode send_invoice)
  • we create the transfers
  • we return the clientSecret to the frontend
  • frontend uses it to for PaymentElement
  • user proceeds with payment

we cannot add source_transaction because the charge is undefined

#

I just wanted to make sure, that there is no way to create the transfers at this time, right?

pine thunder
#

You are trying to send to multiple Connected Accounts, yeah?

#

And unless it is an async payment method then you do have the Charge at that time, otherwise you are correct you don't, and you would have to wait for payment_intent.succeeded to create the Transfers.

agile harbor
#

You are trying to send to multiple Connected Accounts, yeah?
yes

#

And unless it is an async payment method then you do have the Charge at that time, otherwise you are correct you don't, and you would have to wait for payment_intent.succeeded to create the Transfers.
in our tests the charge is undefined in my outlined scenario and your colleauge confirmed, that a charge is only created if a payment is actually tried

#

I mean, we can put it in the webhook, this is not a problem

#

I would just like to understand the details ๐Ÿ™‚

pine thunder
#

Indeed you would only see a Charge once payment is completed.

#

But I don't understand how/why you would be transferring funds before that anyway...

agile harbor
#

yeah, we don't want to transfer the funds beforehand. I understood the docs, that we can create the transfers and if we add source_transaction property, it will only be executed once the source transaction is finished

pine thunder
#

No, source_transaction allows you to transfer funds related to a Charge before the funds are actually availalbe. They will then remain pending in the Connected Account until available. Otherwise, you can't transfer the funds at all until they are available.

#

source_transaction does not hold the execution of the transfer itself

agile harbor
#

okay

#

thanks for the information

#

we will move everything to the webhook now and should be good to go