I need to figure out which transfers are part of custom connected account payouts!
I'm using Stripe and creating transfers to pass money from my platform to different custom connected accounts. One custom connected account might receive 300+ different transfers with amounts. When Stripe pays out to the connected account, I receive a couple of webhooks (payout.created, payout.paid) and these contain a balance transaction id, which looks like it is the only id that can be used to fetch any transfers from that payout, but how? or is this not how you would do it?
FYI - I need a way to update each connected account transfer to show they are now paid, instead of pending...
When you have a payout ID(po_xxx), you can filter balance transactions on the connected account by that ID — this returns all the transactions that were paid out in that payout object: https://stripe.com/docs/api/balance/balance_history#balance_history-payout
From these transactions, you can find the source of the transaction : https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-source
When you make a transfer to a connected account, a py_xxx object is created on the connected account, representing the payment, and this would be the source of the balance transactions. This payment object has a source_transfer field which is the ID of the transfer(tr_xxx).
Putting this all together, if you want to know which transfers were paid out in a given payout, you would combine a list payout call with the expanding objects feature of the API to retrieve all the information at once. It's something like this in Node:
await stripe.balance.listTransactions({
payout: "po_xxx",
expand : ["data.source.source_transfer"]
}, {stripe_account : "{CONNECTED_ACCOUNT_ID"}).autoPagingEach(function(transaction) {
console.log(transaction.source.source_transfer.id); // the tr_xx transfer object
});
Related
Pretty new to Stripe, we're building an online marketplace. Each user can buy assets from any other user. We also take fees for each payment.
We go with connected accounts. Seller goes through the onboarding flow (create connected account, create account link etc), while buyer is registered as a customer of our platform on Stripe.
Now, whenever buyer makes a payment we create a payment intent to pay to us (amount + 20% fee via):
stripe.paymentIntents.create(params)
Then we create new payout to seller (amount) using source transaction from payment intent above:
await stripe.transfers.create({
amount: payment.amount * 100,
currency: payment.currency,
destination: seller.stripeAccountId,
source_transaction: sourceTransaction,
});
Is this the preferred and best way of handling this? In terms of time, we need first to wait for payment to settle to our bank account to be able to payout seller?
Is there any better way of doing this instead of manual payouts?
Is there a way to make direct transfer to connected account when user does payment?
I tried with payment intent, specifying connected account id in request, but API is complaining that customer id is on our platform but account id is specified, so it's not possible obviously.
Also, manual payouts would come handy to simulate payment escrow/deposit. When user create a request for some asset, we would immediately transfer certain amount to our account, like reserving that amount. And if the seller accepts the offer, we would do a payout. If seller rejects the offer, we would do payout to the buyer, giving him back his money.
Does this make sense?
Thanks in advance
You don't need Payout (yet) in your use case. You are doing Separate Charges and Transfers, and fund simply moves from your Account's balance to Connected Account's balance. It hasn't been out of your Connected Account's balance to your Connected Account's bank account yet, which is called "Payout".
In another word, Payout is separated process than Charges and Transfers. Charges and Transfers can happen immediately, and Payouts normally happen later on a daily basis or manually.
Find more explanation on Connect Balance.
There is also Destination Charge which is simpler than Separate Charges and Transfers. I recommend Destination Charge unless you have specific reason to use Separate Charges and Transfers, ie. you need to transfer to multiple Connected Accounts on one payment.
Normally when using stripe I can create products and add tax rates, shipping rates. After the payment I can create invoice. I want to do the same thing when using connected account. In my app I want users to create stores and this stores' product will be saved to their connected stripe account. Stores in my app will set shipping rates and tax rates. Then I can automatically invoice the payment. That's what I want to do. Is it possible to do with stripe? Because I read the documents but I could not understand the invoicing on connected accounts. Because when invoicing the connected account only customer id required. That confused me.
Invoice connected accounts document
I'm not sure you'll be able to do things exactly how you describe but I'd suggest you reach out to Support to talk about this further: https://support.stripe.com/contact/email
I am trying to access a payout object (https://stripe.com/docs/api#payouts) from a charge object (https://stripe.com/docs/api#charges). The problem is that I do not know what ID to use for the payout. I tried using the transfer ID from payouts but I get the error:
No such payout: tr_1Bxxxxxxxxxx
I also know that the ID of the payout is in the format po_xxxxxxxxxxxxxxx but I can't find any from the charge, the transfer and the balanced_transaction. How is the payout related to the charge?
There's not a direct way to get the Payout from a Charge object ch_xxxyyyzzz, but if your account is setup to make automatic payouts, you can get a list of charges and any other balance transactions (refunds, adjustments, etc) that make up a specific payout object.
https://stripe.com/docs/api#balance_history-payout
stripe.balance.listTransactions({payout:"po_xxxyyyyyyzzz",limit: 100 },
function(err, transactions) {
// asynchronously called
});
Payouts and Transfers are two separate types of Objects. A Payout always refers to when moving funds from your balance to your bank account. A Transfer refers to funds moving between Stripe accounts, typically in the context of Stripe's Connect.
https://stripe.com/docs/transfer-payout-split
I have transfers that were related with payments. I can see those through dashboard but seems they are not available to get using the API.
This is my charge on dashboard, as you can see it has two connected objects a customer and a transfer
Transfer connected with many payments
Once you have fetched a transfer you can use the transfer ID with the balance transaction method. It's the only parameter you need to pass and it will return all the transactions related to that transfer.
If you are using NodeJS for example then it would be:
stripe.balance.listTransactions({ transfer: 'tr_8ahwq8qw34n' })
Stripe API has method for retrieving transfers by transferID Transfer::retrieve($transferId);
but always return that transfer doesn't exist when I try to retrieve transfer for connected Account.
I want to send email to particular connected account when the founds will be transfered to his bank account.
How to achieve this?
In the Ruby API, you can achieve this by passing in the stripe_account, like this:
Stripe::Transfer.retrieve(transfer_id, {:stripe_account => acct_id})
If you want to trigger an action on your side based on funds being transferred, you might want to use webhooks.