PayPal智能按钮/订单V2 API发货价值

问题描述

是否可以向PayPal结帐处添加自定义的运费,例如物品?

enter image description here

下面是一些带有静态值的示例代码。

var paypalAmount = {"value":"78.95","breakdown":{"item_total":{"currency_code":"USD","value":"78.95"}}};

var paypalItems = [{"name":"sample item","unit_amount":{"currency_code":"USD","value":"39.95"},"quantity":"1","category":"PHYSICAL_GOODS"},{"name":"sample item2","value":"39.00"},"category":"PHYSICAL_GOODS"}];

  createOrder: function(data,actions) {
            return actions.order.create({
                purchase_units: [{
                    amount: paypalAmount,items: paypalItems
                }],headers: {
                    'content-type': 'application/json'
                },});
        }

解决方法

在“数量”中,您传递了一个“细分”对象,该对象带有一个“装运”参数,如此处所示:https://developer.paypal.com/docs/api/orders/v2/#definition-amount_breakdown

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...