#nicolas_six

1 messages · Page 1 of 1 (latest)

coral latchBOT
heady storm
#

As you note, transfer_data can only take one account so you will need to create Transfers explicitly to achieve this. If you set the source_transaction property on the transfer that will tell Stripe to transfer the funds immediately once they land on your account https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-availability

Learn how to use Connect to create charges on your platform account on behalf of connected accounts, perform transfers separately, and retain funds in the process.

dense gorge
#

Thanks for your quick answer! I am trying to do that, but I'm facing the following error : stripe.error.InvalidRequestError: Request req_BeMrV5Yw9Wf7PH: No such charge: 'pi_3NiIID[...]'

The transfer operation takes as a source_transaction parameter the id of the payment intent freshly created, but it doesn't seem to work

heady storm
#

Can you show me your code for how you are creating the original payment intent?

#

It sounds like you may be creating the intent on one of the connected accounts

dense gorge
#

Sure! Here is the full block of code:

#

Basically the flow I'm looking for is as follows:

  • there is a ticket amount and a product amount that must be checked out by the customer at the same time (so 1 paymentintent)
  • the full product amount should be transfered to the shop account
  • the ticket amount minus the ticket_fee_amount should be transfered to the stripe account
  • the balance of the payment intent should be negative because the full product amount was given to the shop account so it should be taken from our account (but as I understood this is automatic)
heady storm
#

Oh sorry I see now, source_transaction is expecting a charge ID (ch_123 or py_123)

#

You can get the charge from the latest_charge field on the PaymentIntent that you get after the payment intent has been confirmed

#

So unfortunately you can't set all of this up before the intent has been confirmed but you can definitely automate the second transfer with a webhook event

dense gorge
#

But in this case, the amount of the PaymentIntent is in transit on our Stripe account between the moment where the user pays the order and the moment where the webhook is called (supposing I am transfering the amount to the second account at this moment), right?

heady storm
#

Yes, there wouldn't be a way to do this without the funds being on their way to your account at some point. If it helps, I have heard of users that needed to keep funds separate for legal reasons but it ended up being more related to bank accounts than Stripe accounts. If you are unsure about how this may affect regulatory requirements for you, you can reach out to our support team and they may be able to help look in to this with you https://support.stripe.com/?contact=true

dense gorge
#

Thank you for your answer, I'll try to make it work with transfers and check if it is acceptable to hold funds for a small period of time in our case.

By any chance, for two accounts, could it be possible to both use the on_behalf_of field as the first account, and use the transfer_data field for the second account?

heady storm
#

I think you could but that wouldn't affect how the transfers are created. It would make the on_behalf_of merchant the merchant of record and has a couple other implications but the transfers would still need to be made the same way.