【问题标题】:How to calculate product price after adding payment gateway commission to it?添加支付网关佣金后如何计算产品价格?
【发布时间】:2018-04-11 03:32:20
【问题描述】:

我们有一件商品要卖 100 美元左右。有 5% 的税适用于它。第三方支付网关收取网关总金额的 3% 的佣金(即 100 的 3%+5%)。 由于无法向客户收取 3% 的支付网关佣金,我们将这笔额外佣金隐藏在商品价格下。 所以价格应该从 100 增加到“X”数量。

(100 + 5% tax) + 3% Commission = (X + 5% Tax) ;

请注意,当从 X + 5% Tax 增加金额时,佣金也会增加。

(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.

包含支付网关佣金后如何查询产品价格?

【问题讨论】:

    标签: php payment-gateway ccavenue


    【解决方案1】:

    不要以“加”的方式思考,以“乘”的方式思考:

    用因子 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 - 佣金)

    请看看我的回答,如果您想在商店价格中考虑佣金部分的税金,请告诉我。你可以这样做,但我认为从会计角度来看这是错误的。

    【讨论】:

    • 简而言之,您需要 y=x*0.97 的反函数。这就是 y'=x*(1/0.97)。
    • 您在这里说错了“您可以这样做,但我认为从会计角度来看这是错误的。” ?
    【解决方案2】:

    在这种情况下,使用此代码:

    $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));
    

    此代码返回如下:

    price with tax 105
    price with tax and commission 108.15
    product price is=>103
    product price with commission 108.15
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-29
      • 2018-03-05
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-12
      • 1970-01-01
      相关资源
      最近更新 更多