question

dvbangar8 avatar image
dvbangar8 asked parquet76 answered

Issue Creating Order in E-commerce Platform

I hope this message finds you well. I am currently experiencing an issue while attempting to create orders in my e-commerce platform using your API. Despite having a correct authentication token, I am encountering an error that I am unable to resolve. Here are the details of the error I am encountering:


**Error Details:** ```json { "message": "400 Bad Request", "error": { "type": "invalid_request_error", "code": "invalid_request", "message": "Please provide a valid collection of items for this order" } }


I am using Postman for testing, and it seems that the API is responding with a "400 Bad Request" error, specifying that a valid collection of items is required for the order.

Request Information:

const options = {
method : 'POST' ,
url : 'https://scl-sandbox.dev.clover.com/v1/orders' ,
headers : {
accept : 'application/json' ,
'content-type' : 'application/json' ,
authorization : `Bearer ${ config . get ( 'clover.accessToken' ) } ` , },
data :
{
orderData , }, };


```

{

"currency": "cad",

"customer": "dharamveer bangar",

"email": "smartstar8@gmail.com",

"expand": ["test"],

"items": [

{

"amount": 0,

"currency": "cad",

"description": "test",

"inventory_id": "123",

"quantity": 1,

"tax_rates": [

{ "name": "one test", "rate": 0 },

{ "name": "two test", "tax_amount": 0 },

{ "name": "two test test", "tax_rate_uuid": "123" }

],

"type": "shipping"

}

],

"metadata": {

"additionalProp": "hello world"

},

"shipping": {

"address": {

"city": "jalandhar",

"country": "india",

"line1": "jalandhar punjab india",

"line2": "jalandhar punjab india",

"postal_code": "144801",

"state": "punjab"

},

"name": "hello world",

"phone": "+911232123123"

}

}



```

  • I have double-checked the authentication token and the request payload, but the error persists. I suspect there might be an issue with the way I am providing the collection of items for the order.
e-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
parquet76 avatar image
parquet76 answered

I would start with the documentation here - https://docs.clover.com/docs/working-with-orders

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community