x

error with line_items formatting using php sdk library

I'm trying to store an order for later transaction submissions.  I package the items as listed in the sdk and I can see they are properly added to the object.  However when I submit the createOrder I get this error:

"errors":[{"category":"INVALID_REQUEST_ERROR","code":"VALUE_EMPTY","detail":"Field must not be blank","field":"line_items[0].quantity"}
 

There is a quantity associated with the line item in the object so I don't understand what is the error.

 

I tried to package the line items in an array and inside [] but that didn't help.

 

Here's the object that I submit in the createOrders as the "body":

 

array(2) { [0]=> object(SquareConnect\Model\CreateOrderRequestLineItem)#13 (15) { ["name":protected]=> NULL ["quantity":protected]=> NULL ["base_price_money":protected]=> NULL ["variation_name":protected]=> NULL ["note":protected]=> NULL ["catalog_object_id":protected]=> NULL ["modifiers":protected]=> NULL ["taxes":protected]=> NULL ["discounts":protected]=> NULL ["setName"]=> string(23) "rfOrg Test Subscription" ["setQuantity"]=> string(1) "2" ["setBasePriceMoney"]=> object(SquareConnect\Model\Money)#16 (4) { ["amount":protected]=> NULL ["currency":protected]=> NULL ["setAmount"]=> int(100) ["setCurrency"]=> string(3) "USD" } ["setVariationName"]=> string(6) "normal" ["setNote"]=> string(3) "boo" ["setCatalogObjectId"]=> string(0) "" } [1]=> object(SquareConnect\Model\CreateOrderRequestLineItem)#17 (15) { ["name":protected]=> NULL ["quantity":protected]=> NULL ["base_price_money":protected]=> NULL ["variation_name":protected]=> NULL ["note":protected]=> NULL ["catalog_object_id":protected]=> NULL ["modifiers":protected]=> NULL ["taxes":protected]=> NULL ["discounts":protected]=> NULL ["setName"]=> string(18) "Paleo Subscription" ["setQuantity"]=> string(1) "1" ["setBasePriceMoney"]=> object(SquareConnect\Model\Money)#19 (4) { ["amount":protected]=> NULL ["currency":protected]=> NULL ["setAmount"]=> int(100) ["setCurrency"]=> string(3) "USD" } ["setVariationName"]=> string(6) "normal" ["setNote"]=> string(3) "boo" ["setCatalogObjectId"]=> string(0) "" } }
 


 

any help is appreciated.   

 

thanks

nicholas

593 Views
Message 1 of 2
Report
1 REPLY 1
Square Community Moderator

Hi @nicopaholo

 

Can you provide more information on this?

 

We'll need to see the code that you're using to make the request in order to figure out what might be happening.  

581 Views
Message 2 of 2
Report