当我在价格和金额字段中尝试这些值时,它给出了一个错误。如果该值不是 float 或小数,它工作正常: 代码:
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://localhost:2300/success",
"cancel_url": "http://localhost:2300/cancel"
},
"transactions": [{
"item_list": {
"items": [{
"name": "Item",
"sku": "Item",
"price": '0.0015',
"currency": "INR",
"quantity": 1
}]
},
"amount": {
"currency": "INR",
"total": '0.0015'
},
"description": 'Item description.'
}]
};
错误:
响应:
{ 名称:'VALIDATION_ERROR',
message: '无效请求 - 查看详情',
debug_id: 'f42749ec22229',
information_link: 'https://developer.paypal.com/docs/api/payments/#errors',
详细信息:[[对象]],
httpStatusCode: 400 },
httpStatusCode: 400
最佳答案
您应该打印出 details: [ [Object] ],
如果您查看 JSON 响应的 details 数组,它应该显示 INVALID_CURRENCY_AMOUNT_FORMAT
大多数 PayPal 支持的货币,包括 INR
,只允许两位小数,即不能小于/超过 .01
关于javascript - node.js 中的 PayPal 字段和小数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59564439/