条纹连接PHP - 拆分付款?

时间:2016-12-12 08:50:39

标签: php stripe-payments stripe-connect

我使用带有托管帐户的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%(或任何部分金额)的付款发送到目标帐户,其余部分保留在我们的帐户中?我真的不想为客户购买两次卡片,只是为了推广这种模式。

1 个答案:

答案 0 :(得分:2)

creating a charge with Connect时,您可以使用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,
));