Stripe Connect: What's the difference between Customers and Accounts?
Asked Answered
B

1

31

Currently, it seems as though Connect's Accounts does everything the Customers does, e.g. it is possible to add a bank card directly to the Accounts account. So just creating an Accounts object for a user seems enough, but would there ever be a case I would have to create a Customers object?

For example, in the tutorial (https://stripe.com/docs/connect/payments-fees), the TOKEN could simply provide the Accounts publishable key:

stripe.charges.create({
  amount: 1000,
  currency: 'usd',
  source: {TOKEN},
  destination: {CONNECTED_STRIPE_ACCOUNT_ID}
});

For clarification, is source where the funds will be pulled from, and destination is where the funds will be headed? And the funds will be deposited into the destination's default bank account?

Also, when an Accounts gets created via API, will the newly connected account be viewable via the platform's dashboard? And also be able to view transactions and balance?

Lastly, when transferring funds, by not defining the source, does that mean the funds will be pulled from the platform account's balance?

var stripe = require('stripe')(PLATFORM_SECRET_KEY);
stripe.transfers.create(
  {
    amount: 1000,
    currency: "usd",
    destination: "default_for_currency"
  },
  {stripe_account: CONNECTED_STRIPE_ACCOUNT_ID}
);

Will accept/upvote the answer. Thank you in advance.

Billfold answered 24/10, 2016 at 22:26 Comment(0)
B
61

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

Bracteate answered 24/10, 2016 at 23:17 Comment(6)
Really appreciate the in-depth insight. In need of some clarification, does putting {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 put destination 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 providing stripe_account in the headers is acting as the source? Thank you in advanceBillfold
Yes that's right, when using {stripe_account: CONNECTED_STRIPE_ACCOUNT_ID} you're acting on behalf of that account. destination charge is happening on the Platform and funds are being moved (automatically) to the destination. Passing "stripe_account" effectively makes the action occur on that account. Accounts are never a source you can charge. "Must provide source or customer." means that you need to provide a source, if you passed stripe_account as acct_128vxaLwTNBjRk7o, it must be either a Customer or token on the acct_128vxaLwTNBjRk7o account.Bracteate
Very informative - I got much more out of this than I did from the official docs.Gym
It's great explanation, much better overview than in official docs. Anyway I still have a question - when I create card token I can use it in 'source' when creating charge, but you mentioned that if this token is assigned to customer then it should be possible to work only with customer id 'cus_xxxx'. however it always fails claiming that 'No such token: cus_xxxx'.Sawbuck
@ArturSkrzydło make sure you are passing the customer id to the customer property rather than source on your charge request. stripe.com/docs/… And if you're still having issues it may be a case of 1) using incorrect API keys, 2) if you're using Connect you could be trying to access a customer on the wrong account (e.g. the Customer is located on your Platform but you are making the request on a Connected account, etc).Bracteate
@Bracteate You're right, issue was because my Customer was located on a platform and I was calling direct charge on behalf of some a Connected account. I have saved customer for this account and now it works like charm. Many thanks !Sawbuck

© 2022 - 2024 — McMap. All rights reserved.