添加支付网关佣金后如何计算产品价格?
How to calculate product price after adding payment gateway commission to it?
我们有一件商品要卖,价值大约 100 美元。对其征收 5% 的税。第三方支付网关收取支付给网关的总额的 3% 的佣金(即 100 的 3% + 5%)。
由于无法向客户收取 3% 的支付网关佣金,我们将这笔额外佣金隐藏在商品价格下。
所以价格应该从 100 增加到 "X" 数量。
(100 + 5% tax) + 3% Commission = (X + 5% Tax) ;
请注意,当 X + 5% 税增加金额时,佣金也会增加。
(100 + 5%) + 3% = (100 + 5) + 3.15 = 108.15
如果我们向网关发送108.15,它会在108.15 的数量上收取3.255,这意味着额外增加0.105。 IE。扣除网关佣金后,我们收到的金额较少 (104.895)。
我需要隔离不会导致公司额外收费的商品价格。
$tax = 5 ; //5%
$itemAmount = 100 ;
$priceWithTax = $itemAmount + ($itemAmount * 5/100) ;
$commission = 3 ; //3%
//We sent 105 to gateway.. which results 105 to customer and 3.15 to company.
$priceWithTaxCommission = $priceWithTax /* or X */ + ($priceWithTax * $commission/100) ;
$ToGateway = $priceWithTax + ($priceWithTax* 3/100) ;
//Results 108.15, If we sent 108.15 to gateway it again charge 3% on 108.15. Which is wrong.
如何在包含支付网关佣金后找到产品价格?
不要用 "add" 的术语思考,用 "multiply" 的术语思考:
将你的价值乘以因子 f:
f = 1/0.97
100 * (1/0.97) * 1.05 = ~108.25(含税商店价格)
108.25 * 0.03 = ~3.25(佣金)
-> 105.00(剩下的是 100 + 5% 税)。
您还可以参数化因子 f:
f = 100 / (100 - 佣金)
请查看我的回答,如果您想在商店价格中考虑佣金部分的税费,请告诉我。您可以这样做,但我认为从会计角度来看这是错误的。
在这种情况下使用此代码:
$mainPrice = 100;
$tax = 5;
$commission = 3;
$priceWithTax = $mainPrice + ($mainPrice * ($tax / 100));
echo $priceWithTax.'<hr/>';
$priceWithTaxCommission = $priceWithTax + ($priceWithTax * ($commission / 100));
echo $priceWithTaxCommission.'<hr>';
$x = $priceWithTaxCommission / (1+($tax / 100));
echo 'product price is=>'.$x.'<hr/>';
echo $x + ($x * ($tax / 100));
此代码return如下:
price with tax 105
price with tax and commission 108.15
product price is=>103
product price with commission 108.15
我们有一件商品要卖,价值大约 100 美元。对其征收 5% 的税。第三方支付网关收取支付给网关的总额的 3% 的佣金(即 100 的 3% + 5%)。 由于无法向客户收取 3% 的支付网关佣金,我们将这笔额外佣金隐藏在商品价格下。 所以价格应该从 100 增加到 "X" 数量。
(100 + 5% tax) + 3% Commission = (X + 5% Tax) ;
请注意,当 X + 5% 税增加金额时,佣金也会增加。
(100 + 5%) + 3% = (100 + 5) + 3.15 = 108.15
如果我们向网关发送108.15,它会在108.15 的数量上收取3.255,这意味着额外增加0.105。 IE。扣除网关佣金后,我们收到的金额较少 (104.895)。
我需要隔离不会导致公司额外收费的商品价格。
$tax = 5 ; //5%
$itemAmount = 100 ;
$priceWithTax = $itemAmount + ($itemAmount * 5/100) ;
$commission = 3 ; //3%
//We sent 105 to gateway.. which results 105 to customer and 3.15 to company.
$priceWithTaxCommission = $priceWithTax /* or X */ + ($priceWithTax * $commission/100) ;
$ToGateway = $priceWithTax + ($priceWithTax* 3/100) ;
//Results 108.15, If we sent 108.15 to gateway it again charge 3% on 108.15. Which is wrong.
如何在包含支付网关佣金后找到产品价格?
不要用 "add" 的术语思考,用 "multiply" 的术语思考:
将你的价值乘以因子 f:
f = 1/0.97
100 * (1/0.97) * 1.05 = ~108.25(含税商店价格)
108.25 * 0.03 = ~3.25(佣金)
-> 105.00(剩下的是 100 + 5% 税)。
您还可以参数化因子 f:
f = 100 / (100 - 佣金)
请查看我的回答,如果您想在商店价格中考虑佣金部分的税费,请告诉我。您可以这样做,但我认为从会计角度来看这是错误的。
在这种情况下使用此代码:
$mainPrice = 100;
$tax = 5;
$commission = 3;
$priceWithTax = $mainPrice + ($mainPrice * ($tax / 100));
echo $priceWithTax.'<hr/>';
$priceWithTaxCommission = $priceWithTax + ($priceWithTax * ($commission / 100));
echo $priceWithTaxCommission.'<hr>';
$x = $priceWithTaxCommission / (1+($tax / 100));
echo 'product price is=>'.$x.'<hr/>';
echo $x + ($x * ($tax / 100));
此代码return如下:
price with tax 105
price with tax and commission 108.15
product price is=>103
product price with commission 108.15