四舍五入的Paypal税额

时间:2020-07-21 06:26:21

标签: paypal tax

在一家美国电子商务网站上,我正在寻找有关如何使用Paypal Orders API解决问题的信息

示例

每盏灯的不含税价格为 1547美元

一位客户将其中2盏灯添加到他的购物篮中

第三方服务将计算两盏灯的税额为 274.59美元

2盏含税的总价为 2 * 1547 + 274.59 = $ 3368.59

使用Paypal付款时,我们需要将不同的金额发送到Paypal Orders API。

这是税额出现问题的地方。 贝宝(Paypal)希望它是“公关单位”,意思是274.59 / 2 = $ 137.295

但是Paypal仅接受2位数字:-(

以下是在允许输入3位数字的情况下如何发送订单:

"purchase_units": [{
        "amount": {
            "currency_code": "USD",
            "value": "3368.59",
            "breakdown": {
                "item_total": {
                    "currency_code": "USD",
                    "value": "3094"
                },
                "tax_total": {
                    "currency_code": "USD",
                    "value": "274.59"
                }
            }
        },
        "items": [{
                "name": "Oval lamp",
                "tax": {
                    "currency_code": "USD",
                    "value": "137.295"
                },
                "unit_amount": {
                    "currency_code": "USD",
                    "value": "1547"
                },
                "quantity": "2"
            }
        ]]

这会给我一个错误:

"details": [
    {
        "field": "/purchase_units/0item/0/tax/value",
        "value": "137.295",
        "issue": "DECIMAL_PRECISION",
        "description": "If the currency supports decimals, only two decimal place precision is supported."
    }
]

如果我随后将税金从137.295美元舍入到137.30美元,则会出现此错误:

 "details": [
    {
        "field": "/purchase_units/0/amount/breakdown/tax_total/value",
        "value": "274.59",
        "issue": "TAX_TOTAL_MISMATCH",
        "description": "Should equal sum of (tax * quantity) across all items for a given purchase_unit"
    }
]

如果我将总税额从274.59更新为274.6,则会出现此错误:

"details": [
    {
        "field": "/purchase_units/0/amount/value",
        "value": "3368.59",
        "issue": "AMOUNT_MISMATCH",
        "description": "Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount."
    }
]

我现在唯一的选择是将总额从$ 3368.59更改为$ 3368.6,但这是不正确的!

任何输入都值得赞赏

1 个答案:

答案 0 :(得分:0)

在这里没有太多要说的-您的问题已解决。计算每件商品的税金,根据需要向上或向下取整,您将获得不同的税金总额。使用它。

如果要将订单总额调整为其他计算方式,则需要添加另一个带有正数或负数的订单项。