Mian Majid
Mian Majid

Reputation: 844

how split payments by stripe api?

I am building a website for charity donations. I have to get payment a from user/donator and transfer 20% to the website account and 80% to the donation campaign account. Using PayPal I have adaptive payments method, but what should I do with Stripe payments? Which method can be used for the Stripe API?

Upvotes: 20

Views: 36079

Answers (3)

Lonare
Lonare

Reputation: 4703

well you can also use it with stripe connect and distribute it like this

// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_0nEtpmgWlX0mXXE6aMXQhhs1");

// Create a Charge:
$charge = \Stripe\Charge::create(array(
  "amount" => 10000,
  "currency" => "gbp",
  "source" => "tok_visa",
  "transfer_group" => "{ORDER10}",
));

// Create a Transfer to a connected account (later):
$transfer = \Stripe\Transfer::create(array(
  "amount" => 7000,
  "currency" => "gbp",
  "destination" => "{CONNECTED_STRIPE_ACCOUNT_ID}",
  "transfer_group" => "{ORDER10}",
));

// Create a second Transfer to another connected account (later):
$transfer = \Stripe\Transfer::create(array(
  "amount" => 2000,
  "currency" => "gbp",
  "destination" => "{OTHER_CONNECTED_STRIPE_ACCOUNT_ID}",
  "transfer_group" => "{ORDER10}",
));

Upvotes: 1

Josh
Josh

Reputation: 2508

Stripe connect will work fine for this, just keep in mind it only works in select countries as listed here https://stripe.com/global. Any other country you could still accept payment and then divide up and distribute the funds yourself manually which may incur transfer costs.

Upvotes: 1

Ywain
Ywain

Reputation: 17533

You need to use Stripe Connect for this.

Basically, the platform (= you) would have your own Stripe account, and each donation campaign would have their own account, connected to yours (meaning they granted you permissions to accept payments on their behalf).

You would then be able to create charges for them, using the application_fee parameter to specify your split. There are two different ways to go about it, which are explained here: https://stripe.com/docs/connect/payments-fees.

Upvotes: 31

Related Questions