When developing a Platform there are two functions you're generally interested in: paying out and taking payment from users. Stripe divides these functions up into two separate object types.
Accounts
An Account
is an object to represent a user that you pay out to. An account can have an External Account
(a bank account, or in some cases, a debit card) attached. For compliance reasons an account will need to provide some personal information verify the user's identity.
There are three types of accounts you can connect to a Platform:
Standard
(formerly called Standalone
), which are normal Stripe accounts. You connect a Standard Stripe account to your platform through an OAuth-based flow.
Custom
(formerly Managed
), which give you much more control over
the user experience, but require more work on your end: you control custom accounts entirely through the API and are responsible for building a dashboard, sign-up forms, and other account management interfaces.
Express
accounts, which lie somewhere between Standard and Custom. Stripe provides Express users with an easy sign-up form and a lite dashboard.
https://stripe.com/docs/connect/connecting-to-accounts
Customers
A Customer
is an object you can save a Credit Credit, Bank Account, Bitcoin Receiver, etc to and then charge / take payment from. https://stripe.com/docs/api#customers
Stripe offers the ability to create a Customer
object if you'd like to store a card and charge it into the future. If you're only interested in a one-off transactions, you could simply take and use a token obtained with Checkout / Stripe.js / mobile sdk and your publishable key.
You can find examples of payment flows using a token for a one-off payment and a Customer here, https://stripe.com/docs/charges
To be clear, there is not a way to pay out to a Customer object or charge the bank account or debit card attached to an Account.
In your first example:
source
is a token, tok_xxxyyyyzzz
, generally obtained via Stripe.js / Checkout / mobile SDK which you'd pass to your backend. If you saved the source to a Customer
on your account, you could pass customer: cus_xxxyyyzzz
instead to charge the default source
on that Customer
.
https://stripe.com/docs/connect/payments-fees#charging-through-the-platform
destination
is the Account
you'd like the funds to flow through. Charging with destination
is most often used with Custom Accounts. When charging this way, funds will move from your Platform to the balance of the destination
Account. If that account is set to automatic transfers, funds will move to their default bank account automatically when those funds become available for transfer.
The flow looks like this:
Charge (token or customer on Platform) -> Platform Balance -> Custom Account Balance (destination) -> Custom Account Bank Account
If you need more control and granularity of the movement of funds from a Custom Account's balance to their bank account(s), you can set the Custom Account to manual transfers. Read more about that here, https://stripe.com/docs/connect/bank-transfers#payout-information
If you're creating Custom Accounts
or users are connecting their Standard Accounts
through the OAuth process, they should be viewable in your dashboard: https://dashboard.stripe.com/applications/users
If you'd like specific detail for the balance of a Connected Account, you'll want to make a call to retrieve their balance or balance transactions, while authenticating with the Stripe Account header (their account id, e.g. acct_xxxyyyyzzzz
)
https://stripe.com/docs/connect/authentication#authentication-via-the-stripe-account-header
https://stripe.com/docs/api#balance_history
Finally, the example you've provided is passing the Stripe-Account header, {stripe_account: CONNECTED_STRIPE_ACCOUNT_ID}
, so it is happening on a connected account --- it is transferring funds from the Connected Account's balance to their default bank account. This would be used if your Connected Account were on manual transfers.
The way you make a transfer from the Platform's balance to a Connected Account is outlined here. https://stripe.com/docs/connect/special-case-transfers#transferring-to-another-stripe-account
As the name "special case transfer" implies, these Platform -> Connected Account
transfers should only happen in limited circumstances (there is not currently a way to move funds from Connected Account -> Platform).
ripe = require('stripe')(PLATFORM_SECRET_KEY);
stripe.transfers.create(
{
amount: 1000,
currency: 'usd',
destination: {CONNECTED_STRIPE_ACCOUNT_ID},
source_transaction: {CHARGE_ID}
}
);
Overall building a Connect flow that works for your needs can be a complex but rewarding undertaking --- I'd recommend chatting with Stripe's support folks if you get stuck on specifics, https://support.stripe.com/email
{stripe_account: CONNECTED_STRIPE_ACCOUNT_ID}
in the request headers mean that I am acting on behalf of that particular account? But if I were to just putdestination
parameter, I am just acting as the platform? Also, I attempted the second example with"stripe_account": "acct_128vxaLwTNBjRk7o"
in the headers but got the following error"Must provide source or customer."
. Thought providingstripe_account
in the headers is acting as the source? Thank you in advance – Billfold