php - PayPal Request keep getting MALFORMED_REQUEST -


i tried send payment paypal. reason malformed_request error. there no more information. not getdata() function exception.

here compiled 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" } } 

i have no idea wrong json. i'm using php sdk.

the issue not in sdk. data passing paypal server causing issue. error message not obvious here though.

you not need pass "payer_info" in "payer" object. removing fixes issue. here how json like:

{     "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"     } } 

for more information use samples provided in sdk, , documentation helps debug issues, etc.

here useful links:


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -