Required Field Missing. PHP Paypal REST API -


i'm trying use php paypal rest api. however, seems unable pass list of items through transaction because "required field(s) missing".

$item = new item(); $item->setquantity("1"); $item->setname("stuff"); $item->setprice("305.00"); $item->setcurrency("usd");  $amount = new amount(); $amount->setcurrency("usd"); $amount->settotal("305.00");  $item_list = new itemlist(); $item_list->setitems(array($item));  $transaction = new transaction(); $transaction->setamount($amount); $transaction->setdescription("this incredibly awesome."); $transaction->setitem_list($item_list); 

i've filled fields paypal's documentation deems "required" per "common objects" in documentation (https://developer.paypal.com/webapps/developer/docs/api/#common-objects). being thrown error when try redirect paypal start transaction:

exception: got http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment. string(269) "{"name":"validation_error","details":[{"field":"transactions[0].item_list.items[0].sku","issue":"required field missing"}],"message":"invalid request - see details","information_link":"https://developer.paypal.com/docs/api/#validation_error","debug_id":"9e292fc3a312d"}"

when comment out $transaction->setitem_list($item_list);, works properly. it's obvious missing in item list or item. can't see what.

any ideas?

the error point this:

transactions[0].item_list.items[0].sku 

this filed seems required think need put sku in item array let's it: try add:

$item->setsku("codehere"); 

after

$item->setcurrency("usd"); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -