简体   繁体   English

PayPal JSON 格式更新顺序

[英]PayPal JSON format updating order

I know I am close on this, the error messages are getting nicer.我知道我已经很接近了,错误消息越来越好。 Currently, I can call a similar call to update the seller's email no issue via Postman currently, working on updating the amount and associated objects.目前,我可以通过 Postman 拨打类似的电话来更新卖家的 email no issue,目前正在更新金额和相关对象。 Something in my request format is off.我的请求格式中的某些内容已关闭。

Is my breakdown section in the correct location?我的细分部分是否在正确的位置? The amount_breakdown documentation looks like it is on same level as value and currency_code, so does it need to move into that section. amount_breakdown 文档看起来与 value 和 currency_code 处于同一级别,因此是否需要移至该部分。

Here's my request JSON via Postman:这是我通过 Postman 请求 JSON:

[
    {
        "op": "replace",
        "path": "/purchase_units/@reference_id=='default'/amount",
        "value": {
            "currency_code": "CAD",
            "value": "2",
            "amount": {
                "currency_code": "CAD",
                "value": "2",
                "breakdown": {
                    "item_total": {
                        "currency_code": "CAD",
                        "value": "2"
                    },
                    "tax_total": {
                        "value": "0",
                        "currency_code": "CAD"
                    }
                }
            },
            "items": [
                {
                    "name": "First Product Name",
                    "description": "Optional descriptive text..",
                    "unit_amount": {
                        "currency_code": "CAD",
                        "value": "2"
                    },
                    "tax": {
                        "value": "0",
                        "currency_code": "CAD"
                    },
                    "quantity": "1"
                }
            ]
        }
    }
]

RESPONSE:回复:

{
    "name": "UNPROCESSABLE_ENTITY",
    "details": [
        {
            "field": "/purchase_units/@reference_id=='default'/amount/breakdown/item_total",
            "location": "body",
            "issue": "ITEM_TOTAL_REQUIRED",
            "description": "If item details are specified (items.unit_amount and items.quantity) corresponding amount.breakdown.item_total is required."
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
    "debug_id": "acecd3643c994",
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-ITEM_TOTAL_REQUIRED",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}

Thanks for any help!谢谢你的帮助!

Different variations of objects.对象的不同变化。 I can get the other PATCH operation working no issue but it is much simpler in object structure我可以让其他 PATCH 操作正常工作,但在 object 结构中要简单得多

There should be no amount key under the /amount path, and the items array does not belong at that /amount path either. /amount 路径下不应有amount键,并且items数组也不属于该 /amount 路径。

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

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