我将POST(带有合适的ans
标头)发布到Authorization:
https://api.sandbox.paypal.com/v1/payments/payment
并收到回报
{"intent": "sale", "payer": {"payment_method": "paypal"}, "transactions": [{"amount": 10.0, "currency": "USD", "details": {"subtotal": 10.0, "shipping": 0.0, "tax": 0.0}, "description": "Item 1"}], "redirect_urls": {"return_url": "https://example.com", "cancel_url": "https://example.com"}}
为什么会出错?我怎么了?
答案 0 :(得分:1)
请签出Paypal documentation
请参见右侧的示例。 amount
应该是一个对象-currency
和details
必须是amount
的属性,同样您也缺少必需的total
属性
返工JSON
{
"intent":"sale",
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"10.00",
"currency":"USD",
"details":{
"subtotal":"10.00",
"shipping":"0.00",
"tax":"0.00"
}
},
"description":"Item 1"
}
],
"redirect_urls":{
"return_url":"https://example.com",
"cancel_url":"https://example.com"
}
}
指定“ price-numbers”(总数,小计……)时,请务必小心,它们必须是字符串,并遵守有关十进制数字的规则
答案 1 :(得分:0)