我正在实现 Paypal 的新 REST API Pay with Paypal 方法,可以在此处引用: https://developer.paypal.com/webapps/developer/docs/integration/web/accept-paypal-payment/
付款执行得很好,完全按照它应该的方式执行。用户选择使用 Paypal 付款,然后被重定向到 Paypal 站点,他需要在该站点登录并批准付款。我发送给 Paypal 的 JSON 数据几乎就是上面链接中指定的内容,我的数据如下所示:
{
"intent":"sale",
"redirect_urls":{
"return_url":"http://<return URL here>",
"cancel_url":"http://<cancel URL here>"
},
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"7.47",
"currency":"USD"
},
"description":"This is the payment description."
}
]
当它将用户重定向到 paypal 网站时,描述和总金额列显示为空白
我不确定这是否是 Paypal 的 REST API 上的错误,但我相信我提供了必要的描述 + 付款金额以反射(reflect)在此页面上。如果未显示此信息,通常会对用户造成威慑,因为他们肯定希望看到他们在 Paypal 网站上支付的金额,即使该金额已列在我的网站上。
这是它的样子:
对于那些想表明用户尚未登录的人,好吧,即使登录后,描述和当前购买栏仍然是空白。
我是否缺少任何需要发送到 Paypal 以指示此描述数据的参数?
注意:此问题在实时服务器和沙盒服务器中都存在。
最佳答案
上面页面的左手平移显示: 1.订单中的项目详细信息。您可以将项目列表作为支付资源中交易详细信息的一部分。同样会在这里显示。 2. 交易金额的构成运费、税金等,如果您在请求中包含它们。
尝试此请求以查看示例:
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://<return url>",
"cancel_url": "http://<cancle url>"
},
"transactions": [
{
"amount": {
"total": "8.00",
"currency": "USD",
"details": {
"subtotal": "6.00",
"tax": "1.00",
"shipping": "1.00"
}
},
"description": "This is payment description.",
"item_list": {
"items":[
{
"quantity":"3",
"name":"Hat",
"price":"2.00",
"sku":"product12345",
"currency":"USD"
}
]
}
}
]
}
关于rest - 通过 Paypal REST API 使用 Paypal 付款不会在 Paypal 沙盒或实时网站上显示付款说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15885742/