how split payments by stripe api?

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.


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