我试着把钱寄给PayPal。但出于某种原因,我只得到了一个MALFORMED_REQUEST错误。没有更多的信息了。对于异常,即使使用getData()函数也不行。
下面是编译好的JSON:
{
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"first_name": "Testvorname",
"last_name": "Testnachname",
"email": "test@example.com",
"suffix": "Herr"
}
},
"transactions": [
{
"amount": {
"currency": "EUR",
"total": "72.00"
},
"item_list": {
"items": [
{
"quantity": "4",
"name": "test1",
"price": "8",
"currency": "EUR"
},
{
"quantity": "2",
"name": "test2",
"price": "20",
"currency": "EUR"
}
]
}
}
],
"redirect_urls": {
"return_url": "https://www.google.de",
"cancel_url": "https://www.google.de"
} }我不知道这个JSON会有什么问题。我正在使用PHP。
发布于 2015-08-20 15:49:03
问题不在SDK中。要传递给paypal服务器的数据导致了此问题。但是,错误信息在这里并不明显。
您不需要在"payer“对象中传递"payer_info”。消除这个问题。下面是JSON的样子:
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"currency": "EUR",
"total": "72.00"
},
"item_list": {
"items": [
{
"quantity": "4",
"name": "test1",
"price": "8",
"currency": "EUR"
},
{
"quantity": "2",
"name": "test2",
"price": "20",
"currency": "EUR"
}
]
}
}
],
"redirect_urls": {
"return_url": "https://www.google.de",
"cancel_url": "https://www.google.de"
}
}有关更多信息,您可以始终使用SDK中提供的示例,以及帮助您快速调试问题的文档等。
这里有一些有用的链接:
https://stackoverflow.com/questions/32099506
复制相似问题