# Orders

## Introduction

Through the endpoints included in the Orders section, you will be able to:

* Retrieve information about the orders
* Create new orders
* Retrieve information about a specific order
* Cancel orders

## Endpoints

### Orders

## Show orders

> This API endpoint retrieves information about the orders.

```json
{"openapi":"3.0.1","info":{"title":"merchOne API","version":"Beta"},"servers":[{"url":"https://api.merchone.com/api/beta","description":"API Beta"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"SingleOrder":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the order."},"external_id":{"type":"string","description":"An optional external unique identifier for the order"},"is_test":{"type":"boolean","description":"A boolean indicating whether the order is a test order"},"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"status":{"type":"string","description":"The status of the order."},"status_label":{"type":"string","description":"A human-readable label for the order status."},"created_at":{"type":"string","description":"Creation date and timezone of the order."},"updated_at":{"type":"string","description":"The last update date and timezone of the order."},"shipments":{"type":"array","description":"An array of objects containing details about the shipment","items":{"properties":{"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"tracking_number":{"type":"string"},"tracking_url":{"type":"string"},"shipped_at":{"type":"string"},"items":{"type":"array","items":{"properties":{"item_id":{"type":"integer"},"item_external_id":{"type":"string"},"quantity":{"type":"integer"}}}}}}},"items":{"type":"array","description":"An array of objects representing the items in the order.","items":{"type":"object","properties":{"id":{"type":"integer","description":"The unique identifier for the item."},"external_id":{"type":"string","description":"An optional external unique identifier for the item."},"variant_id":{"type":"string","description":"The unique identifier for the item variant."},"name":{"type":"string","description":"The name of the item."},"quantity":{"type":"integer","description":"The quantity of the item in the order."},"price":{"type":"number","description":"The price of the item."},"price_details":{"type":"object","description":"An object containing details about the price of the item.","properties":{"currency":{"type":"string","description":"The currency of the price."},"formatted":{"type":"string","description":"A human-readable representation of the price."},"in_subunit":{"type":"integer","description":"The price in the smallest unit of the currency"}}},"file":{"type":"string","description":"The URL of the image associated with the item"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"value":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}}}},"totals":{"type":"object","properties":{"subtotal_amount":{"type":"number"},"subtotal_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"shipping_amount":{"type":"number"},"shipping_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"total_amount":{"type":"number"},"total_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"customs_shipping_costs":{"type":"number"},"customs_shipping_costs_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}}}}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/orders":{"get":{"summary":"Show orders","description":"This API endpoint retrieves information about the orders.","responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/SingleOrder"},{"properties":{"meta":{"type":"object","properties":{"pagination":{"type":"object","properties":{"total":{"type":"integer"},"count":{"type":"integer"},"per_page":{"type":"integer"},"current_page":{"type":"integer"},"total_pages":{"type":"integer"},"links":{"type":"object","properties":{"previous":{"type":"string"},"next":{"type":"string"}}}}}}}}}]}}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

### Create order

## Create an order

> This API endpoint creates an order and returns it.

```json
{"openapi":"3.0.1","info":{"title":"merchOne API","version":"Beta"},"servers":[{"url":"https://api.merchone.com/api/beta","description":"API Beta"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"OrderPost":{"type":"object","properties":{"external_id":{"type":"string"},"is_test":{"type":"boolean"},"shipping_method":{"type":"string"},"customs_shipping_costs":{"type":"number","description":"Used to print the customs duty value of the order item and shipping costs shown on the customs duty invoice"},"shipping":{"type":"object","required":["firstname","lastname","country_id","city","postcode","street_primary"],"properties":{"email":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"company":{"type":"string"},"street_primary":{"type":"string"},"street_secondary":{"type":"string"},"city":{"type":"string"},"postcode":{"type":"string"},"country_id":{"type":"integer"},"region_id":{"type":"integer"},"telephone":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["variant_code","file","quantity"],"properties":{"external_id":{"type":"string"},"quantity":{"type":"integer"},"variant_code":{"type":"string"},"customs_value":{"type":"number","description":"Used to print the customs duty value of the order item and shipping costs shown on the customs duty invoice"},"file":{"type":"string"},"options":{"type":"object","properties":{"1":{"type":"integer","description":"'key' is the option's id, 'value' is the option's value id"},"Stretcher frame":{"type":"string","description":"Here the 'key' is the option's name, 'value' is the option's value name"}}}}}}}},"SingleOrder":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the order."},"external_id":{"type":"string","description":"An optional external unique identifier for the order"},"is_test":{"type":"boolean","description":"A boolean indicating whether the order is a test order"},"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"status":{"type":"string","description":"The status of the order."},"status_label":{"type":"string","description":"A human-readable label for the order status."},"created_at":{"type":"string","description":"Creation date and timezone of the order."},"updated_at":{"type":"string","description":"The last update date and timezone of the order."},"shipments":{"type":"array","description":"An array of objects containing details about the shipment","items":{"properties":{"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"tracking_number":{"type":"string"},"tracking_url":{"type":"string"},"shipped_at":{"type":"string"},"items":{"type":"array","items":{"properties":{"item_id":{"type":"integer"},"item_external_id":{"type":"string"},"quantity":{"type":"integer"}}}}}}},"items":{"type":"array","description":"An array of objects representing the items in the order.","items":{"type":"object","properties":{"id":{"type":"integer","description":"The unique identifier for the item."},"external_id":{"type":"string","description":"An optional external unique identifier for the item."},"variant_id":{"type":"string","description":"The unique identifier for the item variant."},"name":{"type":"string","description":"The name of the item."},"quantity":{"type":"integer","description":"The quantity of the item in the order."},"price":{"type":"number","description":"The price of the item."},"price_details":{"type":"object","description":"An object containing details about the price of the item.","properties":{"currency":{"type":"string","description":"The currency of the price."},"formatted":{"type":"string","description":"A human-readable representation of the price."},"in_subunit":{"type":"integer","description":"The price in the smallest unit of the currency"}}},"file":{"type":"string","description":"The URL of the image associated with the item"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"value":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}}}},"totals":{"type":"object","properties":{"subtotal_amount":{"type":"number"},"subtotal_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"shipping_amount":{"type":"number"},"shipping_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"total_amount":{"type":"number"},"total_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"customs_shipping_costs":{"type":"number"},"customs_shipping_costs_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}}}}}},"Error":{"type":"object","properties":{"message":{"type":"string","default":"422 Unprocessable Entity"},"errors":{"type":"object"},"status_code":{"type":"integer","default":422}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized"},"LaravelError":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/orders":{"post":{"summary":"Create an order","description":"This API endpoint creates an order and returns it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderPost"}}}},"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SingleOrder"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"422":{"$ref":"#/components/responses/LaravelError"}}}}}}
```

### Get order

## Show an order

> This API endpoint retrieves information about the specific order.

```json
{"openapi":"3.0.1","info":{"title":"merchOne API","version":"Beta"},"servers":[{"url":"https://api.merchone.com/api/beta","description":"API Beta"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"SingleOrder":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the order."},"external_id":{"type":"string","description":"An optional external unique identifier for the order"},"is_test":{"type":"boolean","description":"A boolean indicating whether the order is a test order"},"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"status":{"type":"string","description":"The status of the order."},"status_label":{"type":"string","description":"A human-readable label for the order status."},"created_at":{"type":"string","description":"Creation date and timezone of the order."},"updated_at":{"type":"string","description":"The last update date and timezone of the order."},"shipments":{"type":"array","description":"An array of objects containing details about the shipment","items":{"properties":{"shipping_method":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}},"tracking_number":{"type":"string"},"tracking_url":{"type":"string"},"shipped_at":{"type":"string"},"items":{"type":"array","items":{"properties":{"item_id":{"type":"integer"},"item_external_id":{"type":"string"},"quantity":{"type":"integer"}}}}}}},"items":{"type":"array","description":"An array of objects representing the items in the order.","items":{"type":"object","properties":{"id":{"type":"integer","description":"The unique identifier for the item."},"external_id":{"type":"string","description":"An optional external unique identifier for the item."},"variant_id":{"type":"string","description":"The unique identifier for the item variant."},"name":{"type":"string","description":"The name of the item."},"quantity":{"type":"integer","description":"The quantity of the item in the order."},"price":{"type":"number","description":"The price of the item."},"price_details":{"type":"object","description":"An object containing details about the price of the item.","properties":{"currency":{"type":"string","description":"The currency of the price."},"formatted":{"type":"string","description":"A human-readable representation of the price."},"in_subunit":{"type":"integer","description":"The price in the smallest unit of the currency"}}},"file":{"type":"string","description":"The URL of the image associated with the item"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"value":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}}}},"totals":{"type":"object","properties":{"subtotal_amount":{"type":"number"},"subtotal_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"shipping_amount":{"type":"number"},"shipping_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"total_amount":{"type":"number"},"total_amount_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}},"customs_shipping_costs":{"type":"number"},"customs_shipping_costs_details":{"type":"object","properties":{"currency":{"type":"string"},"formatted":{"type":"string"},"in_subunit":{"type":"integer"}}}}}}},"Error":{"type":"object","properties":{"message":{"type":"string","default":"422 Unprocessable Entity"},"errors":{"type":"object"},"status_code":{"type":"integer","default":422}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized"},"LaravelError":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/orders/{order_id}":{"get":{"summary":"Show an order","description":"This API endpoint retrieves information about the specific order.","parameters":[{"name":"order_id","in":"path","description":"`order_id` or `@external_id`","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SingleOrder"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"422":{"$ref":"#/components/responses/LaravelError"}}}}}}
```

### Delete order

## Cancel an order

> This API endpoint cancels a specific order.

```json
{"openapi":"3.0.1","info":{"title":"merchOne API","version":"Beta"},"servers":[{"url":"https://api.merchone.com/api/beta","description":"API Beta"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"responses":{"UnauthorizedError":{"description":"Unauthorized"},"LaravelError":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","default":"422 Unprocessable Entity"},"errors":{"type":"object"},"status_code":{"type":"integer","default":422}}}}},"paths":{"/orders/{order_id}":{"delete":{"summary":"Cancel an order","description":"This API endpoint cancels a specific order.","parameters":[{"name":"order_id","in":"path","description":"ID of the order","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Order successfully canceled"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"422":{"$ref":"#/components/responses/LaravelError"}}}}}}
```

## **Order status**

Order statuses are used to track the progress of an order and provide information about its current state. You can find a more detailed list below:&#x20;

<table><thead><tr><th width="159">Status</th><th>Description</th></tr></thead><tbody><tr><td><strong>Draft</strong></td><td>Order has been submitted but not yet confirmed.</td></tr><tr><td><strong>Accepted</strong></td><td>Order has been confirmed and is being prepared for shipment.</td></tr><tr><td><strong>Fulfilled</strong></td><td>Order has been completed and the product(s) is ready to be shipped.</td></tr><tr><td><strong>Generated</strong></td><td>Order has been generated</td></tr><tr><td><strong>In Progress</strong></td><td>Order is in progress</td></tr><tr><td><strong>Cancelled</strong></td><td>Order has been cancelled by the customer or admin.</td></tr><tr><td><strong>Refunded</strong></td><td>Order has been refunded to the customer.</td></tr><tr><td><strong>Partial Refund</strong></td><td>Order has been partially refunded to the customer.</td></tr><tr><td><strong>Pending</strong></td><td>Order has been placed by the customer and is waiting for payment to be completed.</td></tr><tr><td><strong>Error</strong></td><td>Something went wrong during the processing of the order.</td></tr></tbody></table>

## Parameters

<table><thead><tr><th width="298">Key</th><th>Description</th></tr></thead><tbody><tr><td><code>external_id</code><br>(optional)</td><td>Unique identifier for your orders</td></tr><tr><td><code>is_test</code><br>(optional)</td><td>When value is set to <code>true</code>, the order will be created as a TEST Order (PPOXXXXXXXXT) and will NOT be produced or shipped. When the store is in sandbox mode, all orders are created as TEST Orders regardless of the value sent in this field.<br><code>shipping_method</code> must be valid for the shipping country and the items listed in the order. See the guideline above: Guide to calculate shipping rate/method to find out which shipping methods are valid for the given combination of values. Failure to choose a correct shipping method will result in an error.</td></tr><tr><td><code>shipping_type</code><br>(optional)</td><td>Must be used when <code>shipping_method</code> is unknown or doesn't matter which carrier is used for shipping. The values can be either <code>UNTRACKED</code> or <code>TRACKED</code> as listed under GET <code>api/beta/shipping/types</code> endpoint. If both are provided then <code>shipping_method</code> has higher priority.</td></tr><tr><td><code>customs_shipping_costs</code><br>(optional)</td><td>This value is used to print the shipping costs shown on the Customs Declaration Papers when a shipment is sent to NON-EU countries. The value to place here is the retail shipping price you charged your end customer. It is always used in combination with items' <code>customs_value</code>.</td></tr><tr><td><code>shipping</code></td><td>Object contains the address and required information about end customer. There is no need of billing address.</td></tr><tr><td><code>shipping.email</code><br>(optional)</td><td>End customer's email address.</td></tr><tr><td><code>shipping.firstname</code></td><td>End customer's first name.</td></tr><tr><td><code>shipping.lastname</code></td><td>End customer's last name.</td></tr><tr><td><code>shipping.company</code><br>(optional)</td><td>End customer's company name when the end customer is ordering on behalf of a company.</td></tr><tr><td><code>shipping.street_primary</code></td><td>End customer's street name and house number.</td></tr><tr><td><code>shipping.street_secondary</code><br>(optional)</td><td>Additional address.</td></tr><tr><td><code>shipping.city</code></td><td>End customer's city name.</td></tr><tr><td><code>shipping.postcode</code></td><td>End customer's postal/zip code.</td></tr><tr><td><code>shipping.country_id</code></td><td>End customer's country - ISO 3166-1 numeric-3 OR <code>country_code</code> - ISO 3166-1 alpha-2 standards.</td></tr><tr><td><code>shipping.region_id</code><br>(required for US and Canada)</td><td>End customer's state name - ANSI INCITS 38:2009 digit-2. It should be used in combination with <code>country_id</code>. The list of regions/states can be checked at a<code>/api/beta/regions/{country_id}</code>.</td></tr><tr><td><code>shipping.region_code</code></td><td>It should be used in combination with <code>country_code</code> - ANSI INCITS 38:2009 alpha-2. The list of regions/states can be checked at <code>/api/beta/regions/{country_id}</code>.<br></td></tr><tr><td><code>shipping.telephone</code><br>(optional)</td><td>End customer's phone number - used in case of any problems during delivery by the shipment provider.</td></tr><tr><td><code>items</code></td><td>An array with one or more item objects.</td></tr><tr><td><code>items.external_id</code><br>(optional)</td><td>Unique identifier for your items.</td></tr><tr><td><code>items.customs_value</code><br>(optional)</td><td>This value will be used to print the net item cost shown on the Customs Declaration Papers when a shipment is sent to NON-EU countries. The value to place here is the net retail selling price you charged your end customer. It is always used in combination with order's <code>customs_shipping_costs</code>.</td></tr><tr><td><code>items.quantity</code></td><td>The number of copies to produce of this particular item.</td></tr><tr><td><code>items.variant_code</code></td><td>The identifier of which product variant this item is, for example "DIGI-40X30-1" is for a 40x30 cm canvas. See the guideline above: Guide to get a product variant to find out which code/id to use.</td></tr><tr><td><code>items.variant_id</code></td><td>can be used alternatively in place of <code>variant_code</code> but only ONE of them should be used, failing to do so will result in error or create wrong orders. For example variant id "3" identifies the same 40x30 cm canvas as variant code "DIGI-40X30-1" does. See the guideline above: Guide to get a product variant to find out which code/id to use.</td></tr><tr><td><code>items.article_sku</code></td><td>Can be used alternatively instead of <code>variant_code</code> or <code>variant_id</code> but only ONE of them should be used, failing to do so will result with an error or create wrong orders. For example <code>article_sku</code> "CVS0400301F2SW-APOXXXXXXXX" identifies the same 40x30cm canvas with 2cm Border thickness and pre-uploaded image(APOXXXXXXXX). <code>article_sku</code> can be found in your store product list on the edit product page. <code>article_sku</code> is not a common identifier, it is strictly linked to the store where it was created.</td></tr><tr><td><code>items.file</code></td><td>The URL to the print file for this particular item. See more detailed about the file format, resolution and aspect ratio in the "Print Files" section below.</td></tr><tr><td><code>items.options</code></td><td>A list with one or more options set for a product variant. Some product variant have required options, for example all canvas variants have 2 required options ("Canvas border" and "Stretcher frame"). The key and value of an option can either be their ids or their names. For example, the option "Canvas border" option can be added like<code>'Canvas border':'Stretched'</code> (using names) or can be alternatively added <code>"1" : 3</code> (using ids). The names for keys and values are case-sensitive. The list of options for every variant can be checked at guideline above: Guide to get a product variant and details.</td></tr><tr><td></td><td></td></tr></tbody></table>
