Stripe Retrieve Transfers for connected accounts - stripe-payments

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.

Related

Stripe transfer receipt

I am developing app where transfer money from platform to connect when completing some task.
And then my app customers can get money in their stripe account.
I think they need to get receipt for getting earning when using my app but I can't see how to send receipts to customer's email for transferring.
I know it can by specifying receipts_email when charing and refund but no such stuff in transfer object.
How can my app send receipt to customer for transferring ?
if it's impossible what is providing instead in stripe?
Really I need to get help.
Thank you.
The email receipt feature is only available for Charges which happen when you charge a Customer's card. This is documented here: https://stripe.com/docs/receipts
Stripe does not send email receipts when you transfer funds to a connected account or when funds are sent to their own bank accounts. This is something that you would need to build on your side instead based on the funds you're sending to them.

Stripe: accessing transfers after a connected account gets payed out

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
});

Connect "Stripe Connect" with the Telegram Payment API

How can I use Stripe Connect, let's say to create a "Direct Charge", while sending an Invoice on the Telegram Payment API?
The Telegram API seems to only allow for a "provider_token", I see no further details for the Stripe API, like the required "stripe_account" property for direct charges.
I guess Telegram itself uses Stripe Connect to charge on the users behalf... But that doesn't seem to have stopped this guy from doing something very similar:
https://www.reddit.com/r/TelegramBots/comments/6f6b4z/telepay_a_bot_that_enables_instant_and_secure/
He uses express accounts, but the fundamental problem of not being able to speak to stripe directly seems to be the same.
Thanks :)
You're correct about the Telegram API: there is no way to create a direct charge to a connected Stripe account when receiving payments through Telegram. But there are workarounds. I'm the author of the bot you linked; here's how I managed to move funds from my account to a connected Stripe account via Telegram.
Firstly, you need to accept the payment as usual (e.g. follow the normal sendInvoice flow). For my purposes, I made the payload parameter the ID of the user that is being sent the money (it's later matched with the Stripe account ID in the database, but you can do this however you want). The rest is out of scope of the question, so I won't describe this process in detail; Telegram has a very nice guide on it.
Once you receive the successful_payment event from the Telegram API, you can then transfer the money from your own Stripe account to the linked Stripe account using the Stripe Connect transfers endpoint, but be careful: it doesn't give you the amount that was given to your own Stripe balance (taking fees into account), so you will need to calculate that yourself. Depending on your account, it would look something like this for JavaScript: payment.total_amount - Math.round(payment.total_amount * 0.029 + 30).
After you've transfered the money to their account, you can perform a payout as usual with the payouts Stripe Connect endpoint.
But note that this is just one example; you can use all of the Stripe Connect APIs with this. In fact, you probably have even more flexibility with this, since the funds hit your Stripe account before they reach the connected account's, so you can do whatever you want with them :)
So, TL;DR: Once you've received the successful_payment from Telegram, transfer the money to the connected Stripe account, then perform a payout on it.

How to get payments connected with a certain transfer on Stripe through API?

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

User to user payment on stripe

My requirement is, from my application I want my user to transfer the amount to another user of my application. Assume that both user have stripe account. I have gone through stripe docs, and I understood that in order to do transfer from one user account to another I need to use stripe connect. I could able to do authentication and I'm getting access token successfully for the sender. How can I make a transfer to a recipient ? I have only recipient's email id with me. Should I need to create a recipient through code and do the transfer using that recipient id returns from stripe ?
Im using php. Please help me.
Stripe Connect doesn't work like that. Instead, Connect allows an application to make card charges on behalf of a user and take a portion of the amount. The rest is automatically and immediately put into the user's Stripe account, where it's subject to the normal bank account transfer rules (2-7 day rolling transfers or API-driven manual transfers).
Another way to do this is using Stripe Recipients and Transfers. For example, your application charges a customer $10. You create a Recipient for your user using their bank account information (account number and routing number). Then, you can create a Transfer from your Stripe account to their bank account. Note that this only works for US bank accounts as of today.
If you really want to do user to user transfers, unfortunately Stripe isn't the platform for you. You could use PayPal or you could possibly use Balanced Payments, although again you can only transfer money to and from US bank accounts.

Resources