Getting error during user checkout


#1

Here is my input :-
"data": { "customer": { "id": "c8c1c511-beef-4812-9b7a-9f92c587217c" }, "billing_address": { "first_name": "John", "last_name": "Doe", "company_name": "Moltin", "line_1": "2nd Floor British India House", "line_2": "15 Carliol Square", "city": "Newcastle upon Tyne", "postcode": "NE1 6UF", "county": "Tyne & Wear", "country": "UK" }, "shipping_address": { "first_name": "John", "last_name": "Doe", "phone_number": "(555) 555-1234", "company_name": "Moltin", "line_1": "2nd Floor British India House", "line_2": "15 Carliol Square", "city": "Newcastle upon Tyne", "postcode": "NE1 6UF", "county": "Tyne & Wear", "country": "UK" "instructions": "Leave in porch" } }

The error I’m getting is -

{ "body":"{\"errors\":[{\"status\":400,\"source\":\"data.customer\",\"title\":\"number_one_of\",\"detail\":\"Must validate one and only one schema (oneOf)\"},{\"status\":400,\"source\":\"data.customer.id\",\"title\":\"format\",\"detail\":\"Does not match format 'uuid'\"}]}" }


#2

Hi @jintukumardas

That error suggests you’re sending the name, email and id fields in the customer object. I’d recommend checking exactly what is being passed to the API as the request you posted above isn’t valid JSON so it would be rejected before it was validated.

Thanks,
James


#3

I’m just following whatever has mentioned in the Moltin document.

curl -X POST https://api.moltin.com/v2/carts/:reference/checkout \ -H "Content-Type: application/json" \ -H "Authorization: Bearer XXXX" \ -d $'{ "data": { "customer": { "id": "c8c1c511-beef-4812-9b7a-9f92c587217c" }, "billing_address": { "first_name": "John", "last_name": "Doe", "company_name": "Moltin", "line_1": "2nd Floor British India House", "line_2": "15 Carliol Square", "city": "Newcastle upon Tyne", "postcode": "NE1 6UF", "county": "Tyne & Wear", "country": "UK" }, "shipping_address": { "first_name": "John", "last_name": "Doe", "phone_number": "(555) 555-1234", "company_name": "Moltin", "line_1": "2nd Floor British India House", "line_2": "15 Carliol Square", "city": "Newcastle upon Tyne", "postcode": "NE1 6UF", "county": "Tyne & Wear", "country": "UK" "instructions": "Leave in porch" } } }'