【问题标题】:How can I binding data to paypal-rest-sdk如何将数据绑定到 paypal-rest-sdk
【发布时间】:2018-05-21 14:39:20
【问题描述】:

当我在示例中使用相同的 json 对象时,一切正常,但是当我尝试将我的数据(例如 req.body.totalPrice)放入时,出现错误。

var create_payment_json = {
"intent": "sale",
"payer": {
    "payment_method": "paypal"
},
"redirect_urls": {
    "return_url": "http://return.url",
    "cancel_url": "http://cancel.url"
},
"transactions": [{
    "item_list": {
        "items": [{
            "name": "item",
            "sku": "item",
            "price": "1.00",
            "currency": "USD",
            "quantity": 1
        }]
    },
    "amount": {
        "currency": "USD",
        "total": req.body.totalPrice // return error
    },
    "description": "This is the payment description."
}]
};

【问题讨论】:

  • req.body.totalPrice 需要是字符串吗?
  • 没有。我尝试 let price = req.body.totalPrice.toString() 然后 "total": price and dosn't work too

标签: paypal-rest-sdk


【解决方案1】:

问题是商品价格和金额价格应该相同,否则会出现 400 错误

【讨论】:

    猜你喜欢
    • 2016-02-16
    • 1970-01-01
    • 2018-05-24
    • 2020-08-18
    • 2016-02-10
    • 2011-05-28
    • 2014-03-15
    • 2014-03-08
    相关资源
    最近更新 更多