Stripe Connect PHP - 拆分付款?

Stripe Connect PHP - Split Payments?

我将 Stripe Connect API 与托管帐户一起使用,以便在我的应用程序上向服务提供商分发付款。

我们的应用程序希望收取每笔费用的 20%,然后将剩余部分分配给服务提供商。

我知道我可以收取全部费用并将其发送到托管帐户,如下所示:

\Stripe\Stripe::setApiKey('sk_live_xxxxxx');

$charge = \Stripe\Charge::create(array(
     "amount" => (int) $payment,
     "currency" => "usd",
     "customer" => $customerID,
     "destination" => $providerID
));

但是有没有办法只将 80%(或任何部分金额)的付款发送到目标帐户,将其余部分保留在我们的伞形帐户中?我真的不想为了促进这种模式而不得不向客户的卡收取两次费用。

creating a charge with Connect, you choose your platform's fee with the application_fee参数。所以你可以这样做:

$amount = 1000;  // amount in cents
$application_fee = intval($amount * 0.2);  // 20% of the amount

$charge = \Stripe\Charge::create(array(
    "amount" => $amount,
    "currency" => "usd",
    "customer" => $customerID,
    "destination" => $providerID,
    "application_fee" => $application_fee,
));