#nahinanajahd_api

1 messages ยท Page 1 of 1 (latest)

vagrant yarrowBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

magic zephyr
#

Good morning! I'm here whenever you're ready -- not sure how this is supposed to work. ๐Ÿ˜„

idle sparrow
#

hey there apologies for the delay here

#

Can you explain what you expect the transfer group to be doing here? I don't really understand the end goal

magic zephyr
#

No worries!

#

Sure, so I'm building an invoice on behalf of 2 or more workers. When the invoice is paid, I will need to transfer a portion of the payment to each worker.

idle sparrow
#

ok

magic zephyr
#

From the documentation, it looks like I'm supposed to set a "transfer_group" on the payment intent, so the transfers get grouped under the payment intent (basically money in -> money out)

idle sparrow
#

Grouped in what sense?

#

If you need to split funds with more than one connected account provider, you have to do manual transfers after the payment is collected. The invoice payment would be separate from the transfers.

magic zephyr
#

That I do not know, my guess is for accounting purposes, so there's just not floating transfers of money going out without being connecting to money coming in.

#

I think it's basically to make sure that any outgoing transfer is connected to an incoming source of money (so like credit/debit transactions)

#

The whole transaction should be grouped (invoice/payment in then transfers/payouts out)

#

Yes, I think what you said is the whole point of the transfer_group -- it allows the system to connect the transfers back to the original incoming payment intent.

#

If it was just one, I could use the builtin payout mechanism to do it automagically.

idle sparrow
#

For the payment intent, you can't set this via the invoice API, you'd need to update the invoice-associated payment intent(s) after the fact

magic zephyr
#

Yes, I know that part. What I don't know is how to set the transfer_group on the payment intent attached to the invoice when the invoice gets created.

idle sparrow
#

You can't do it at creation, there's no method to pass that through

magic zephyr
#

Ok, so how do I get it after the invoice is created?

#

Is there some method by which I can summon the payment intend by using the invoice id or something?

magic zephyr
#

Ok, does that work before the invoice has been paid? i.e. it's just payment intents?

#

so I create the invoice, add all the line items, then get the payments -- and the payment intent will be there?

idle sparrow
#

if i recall, the managed payment intent is created when you finalize the invoice

magic zephyr
#

ok, so after finalization, got it. ok, so the flow is create invoice->add line items->finalize->fetch payments->update transfer group->pay invoice

idle sparrow
#

Yep, though i expect you would also be able to update the payment intent after payment to set that group, but you should verify that

magic zephyr
#

i'll likely just do it before to be safe, but thanks for the extra info

#

ok, I'll give this a whirl -- how does the chat thing work, can we keep this open for a bit so I can confirm if it works or not before closing?

idle sparrow
#

yep we can keep this open for a bit while you test, keep us updated

magic zephyr
#

will do, appreciate the help

vagrant yarrowBOT
magic zephyr
#

ok, so tried the flow we discussed, got an error:

#

now I'm trying it before I finalize the invoice

#

ok, so looks like the payment intent does not exist before you finalize the invoice

quasi flax
#

hi there, sorry for the delay, looking into this now

magic zephyr
#

no problem, figure you guys are busy

quasi flax
#

ah, were you able to make it work after you finalized the invoice?

magic zephyr
#

nope, that did not work

quasi flax
#

got it, one moment

magic zephyr
#

after the invoice is finalized, I get that error, before the payment intent does not exist

quasi flax
#

unfortunately this does seem like a limitation on Payment Intents created by Invoices

magic zephyr
#

ok, so I was reading through the docs and an alternative might be to use the source_transaction on transfers and just link the transfer back to the payment

#

so that will likely work fine, weird that the transfer_group thing is limited, but I appreciate your all's help on this.

quasi flax
#

sure thing. you might also look into setting metadata on the invoice if the goal is to just have some data associating it with subsequent transfers

magic zephyr
#

that's a good idea, thanks

vagrant yarrowBOT