繁体   English   中英

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%(或任何部分金额)发送到目标帐户,而将其余款项保留在我们的总帐帐户中? 我真的不想只是为了简化这种模式而收取两次客户卡的费用。

使用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,
));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM