在Stripe中,我想直接在关联帐户上创建费用

时间:2017-01-31 07:34:35

标签: php stripe-payments

这是我的代码示例:

$create_charge = \Stripe\Charge::create(array(
    "amount" => round($total_amount_pass_to_stripe * 100),
    "currency" => $currency,
    "source" => $_POST['stripeToken'],
    "description" => $stripe_description,
    "application_fee" => round($application_fee * 100), // amount in cents
), array("stripe_account" => $stripe_user_id));

在上面的代码中,我通过的金额是134.82美元,申请费是0.74美元

此处条纹将计算总金额:

134.82 * 0.029(这是国际卡费率)+ 0.30 = 4.21

关联帐户将获得134.82 - 4.21 - 0.74 = 129.87

所以我想做的是:

我的关联帐户应该是130美元,我的申请费应该是0.74美元

那么我应该按照预期传递给条纹工作多少钱?

如果你能帮我解决,我将不胜感激。

先谢谢。

1 个答案:

答案 0 :(得分:1)

您可以在this support article中找到需要用来计算金额的公式。

您希望总净额为:

SearchViewController * searchViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
searchViewController.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7f];
[self presentViewController:searchViewController animated:YES completion:nil];

所以根据公式,总量需要是:

  $130 + $0.74
= $130.74

因此,您需要在creating the charge时提供以下值:

  ($130.74 + $0.30) / (1 - 0.029)
= $131.04 / 0.971
= $134.95

条纹将收取如下费用:

amount = 13495
application_fee = 74

所以关联的帐户将收到:

   $134.95 * 0.029 + $0.30
 = $3.91 + $0.30
 = $4.21

您将收到申请费: $134.95 - $4.21 (Stripe's fees) - $0.74 (your application fee) = $130