当我在示例中使用相同的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."
}]
};
答案 0 :(得分:0)
问题是物品价格和金额价格应该相同,否则你会有400错误