Create checkout weird error

programmeuropwielenprogrammeuropwielen Member Posts: 26

Hi,

When I try to create a new Checkout I get a weird error!

code:500

message: Argument 1 passed to Api_Model_Checkout::create() must be of the type array, null given, called in \/var\/www\/seoshop\/seoshop\/app\/frontend\/code\/Core\/Api\/Controller\/Checkouts.php on line 6 and defined

Could you tell me what is wrong?

payload:

{

 "mode": "guest",

 "newsletter": 0,

 "terms": 1,

 "comment": "",

 "billing_address": {

   "zipcode": "*",

   "number": "*",

   "country": "*",

   "address2": "",

   "city": "*",

   "address1": "*",

   "name": "*"

 },

 "shipping_address": {

   "zipcode": "*",

   "number": "*",

   "country": "*",

   "address2": "",

   "city": "*",

   "address1": "*",

   "name": "*",

   "company": ""

 },

 "notifications": false,

 "customer": {

   "firstname": "*",

   "birthdate": null,

   "gender": null,

   "mobile": "*",

   "middlename": "",

   "type": "private",

   "lastname": "*",

   "password": "",

   "phone": "",

   "company": "",

   "vatnumber": "",

   "cocnumber": "",

   "email": "*"

 }

}

ps: replaced all client info with a *


thx

4 comments

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator
    edited March 2021

    Hi @programmeuropwielen,

    Thank you for contacting us.

    This happens when you have invalid JSON syntax, please validate your JSON. I see that you are starting your payload with { } which isn't the start of an array please use [ ]

    Something like:

    [
       {
          "customer":{
             "gender":"male",
             "phone":"+31 123456789",
             "mobile":"",
             "email":"[email protected]",
             "firstname":"API TEST",
             "middlename":"",
             "lastname":"Order",
             "type":"private"
          },
          "billing_address":{
             "name":"API TEST Order",
             "address1":"Herengracht",
             "number":"54",
             "extension":null,
             "zipcode":"1015 BN",
             "city":"Amsterdam",
             "region":"Noord-Holland",
             "country":"nl"
          },
          "shipping_address":{
             "name":"API TEST Order",
             "address1":"Herengracht",
             "number":"54",
             "extension":null,
             "zipcode":"1015 BN",
             "city":"Amsterdam",
             "region":"Noord-Holland",
             "country":"nl"
          },
          "notifications":false
       }
    ]
    

    I hope this helps.

  • programmeuropwielenprogrammeuropwielen Member Posts: 26

    It had todo with special characters.. Iam not using the standard seoshop php lib :)

    problem is solved

  • programmeuropwielenprogrammeuropwielen Member Posts: 26

    And only for checkout you don't need the array btw :)

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator
Sign In or Register to comment.