首页 > 解决方案 > Paypal Node js集成定制

问题描述

我一直在使用 node js 作为后端,并使用 Paypal 作为支付网关。一切正常。我正在使用示例支付数据,即

const create_payment_json = {
        "intent": "authorize",
        "payer": {
            "payment_method": "paypal"
        },
        "redirect_urls": {
            "return_url": "http://localhost:3000/success",
            "cancel_url": "http://localhost:3000/cancel"
        },
        "transactions": [{
            "item_list": {
                "items": [{
                    "name": "Red Sox Hat",
                    "sku": "001",
                    "price": "25.00",
                    "currency": "USD",
                    "quantity": 1
                }]
            },
            "amount": {
                "currency": "USD",
                "total": "25.00"
            },
            "description": "Hat for the best team ever"
        }]
    };

你看,在交易的密钥中有一个名为 item_list 的密钥,我不想在我的 JSON 中传递这个,只要金额数据就足够了。

在此处输入图像描述

在此处输入图像描述

上面的图片是带有item_list的,你可以看到用红色圈出的总量。但是当我只通过金额字段而不是 item_list_field 时,我没有得到这个金额。有没有办法在不通过 this 的情况下显示这个 Total amount item_list。它可以正常工作,item_list但不会向用户显示总量,这可能会使用户感到困惑。有没有针对这个问题的解决方案或建议。

提前致谢

标签: node.jspaypalpayment-gatewaypaypal-sandboxpaypal-rest-sdk

解决方案


推荐阅读