unconditionalcoder
unconditionalcoder

Reputation: 743

Charging a user via Stripe and depositing money into another users account

I have a web application that is basically a store. User's post items to sell, other users purchase them. This is the first time I am using the Stripe API and I need to charge a buyer's credit card (either a customer or just from the stripe token) and then deposit it into the sellers account. I see in the documentation, how to charge the card such as

var stripeToken = request.body.stripeToken;

var charge = stripe.charges.create({
  amount: 1000, // amount in cents, again
  currency: "usd",
  source: stripeToken,
  description: "Example charge",
  metadata: {'order_id': '6735'}
}, function(err, charge) {
  if (err && err.type === 'StripeCardError') {
    // The card has been declined
  }
});

But I am completely confused about on how to deposit the money into the seller's bank account? Do I need the user's bank account info? debit card? Do I make them a customer in my stripe account?

Upvotes: 0

Views: 301

Answers (1)

Ywain
Ywain

Reputation: 17505

You need to use Stripe Connect to accept payments on behalf of others.

You can find the documentation here. In a nutshell, Connect can be used with standalone accounts (which are full-featured Stripe accounts just like yours) and managed accounts (which are "account-like" entities that only exist within your own account).

Which you should use depends on where you are located (managed accounts aren't available everywhere yet) and your exact needs. This article has some information that will help you choose.

You then need to decide if you're going to charge directly on the connected account:

var destination = 'acct_...'; // ID of the destination account
var charge = stripe.charges.create({
  amount: 1000, // amount in cents, again
  currency: "usd",
  source: stripeToken,
  description: "Example charge",
  metadata: {'order_id': '6735'}
}, {stripe_account: destination},
function(err, charge) {
  ...

or through the platform:

var destination = 'acct_...'; // ID of the destination account
var charge = stripe.charges.create({
  amount: 1000, // amount in cents, again
  currency: "usd",
  source: stripeToken,
  description: "Example charge",
  metadata: {'order_id': '6735'},
  destination: destination
}, function(err, charge) {
  ...

Upvotes: 1

Related Questions