> For the complete documentation index, see [llms.txt](https://docs.shopgo.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shopgo.me/management-api/orders.md).

# API Endpoints

## Get All Orders

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/order/`

Get list of all orders.\
\
For a full breakdown of response payload see definition of Order object.

{% tabs %}
{% tab title="200 Orders successfully retrieved" %}

```javascript
{
    "payload": {
        "orders": [<Order>]
    }
}
```

{% endtab %}
{% endtabs %}

## Get Order

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/order/:number`

#### Path Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| number | string | Order number |

{% tabs %}
{% tab title="200 Order successfully retrieved" %}

```javascript
{
    "payload": {
        "orders": <Order>
    }
}
```

{% endtab %}
{% endtabs %}

## Create Payment

<mark style="color:green;">`POST`</mark> `https://api.shopgo.me/v1/management/order/:number/payment/`

#### Path Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| number | string | Order number |

#### Request Body

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| body | object | Payment object |

{% tabs %}
{% tab title="200 Payment successfully created" %}

```javascript
{
    "result": "success",
    "payload": {}
}
```

{% endtab %}
{% endtabs %}

Use this endpoint to create a new Payment for an Order.

Request body can contain one or several fields of the [Payment ](/management-api/objects/payment.md#payment)object. For convenience, all fields were made optional and their default values are as follows ...

| Parameter          | Default Value        |
| ------------------ | -------------------- |
| `total`            | order balance        |
| `method`           | `"cash_on_delivery"` |
| `created`          | server date and time |
| `transaction_data` | `{}`                 |

Because the default value of `total` is the current order balance, calling this endpoint with an empty body will create a cash-on-delivery Payment object that will settle the order. 🤘

### Create Refund

Refunds are special cases of [Payment ](/management-api/objects/payment.md#payment)and can therefore be created by calling this endpoint too.

To create a refund, set `method` to `refund` and use a negative amount for `total`.

## Authorize Order

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/order/:number`

#### Path Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| number | string | order number |

#### Request Body

| Name       | Type    | Description                           |
| ---------- | ------- | ------------------------------------- |
| authorized | boolean | new state of order "authorized" field |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {}
}
```

{% endtab %}
{% endtabs %}

## Cancel Order

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/order/:number`

#### Path Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| number | string | order number |

#### Request Body

| Name      | Type    | Description                    |
| --------- | ------- | ------------------------------ |
| restock   | boolean | free reserved product stock    |
| cancelled | boolean | new value of "cancelled" field |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {}
}
```

{% endtab %}
{% endtabs %}

## Update Order Visibility

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/order/:number`

Show or hide product from dashboard and store front ends

#### Path Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| number | string | order number |

#### Request Body

| Name    | Type    | Description                  |
| ------- | ------- | ---------------------------- |
| visible | boolean | new value of "visible" field |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Update Shipment

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/order/:number/shipment/:id`

#### Path Parameters

| Name   | Type   | Description         |
| ------ | ------ | ------------------- |
| number | string | order number        |
| id     | string | shipment identifier |

#### Request Body

| Name             | Type   | Description                              |
| ---------------- | ------ | ---------------------------------------- |
| state            | string | one of "ready", "shipped" or "delivered" |
| target\_delivery | string | DateTime (see definition in Primitives)  |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {}
}
```

{% endtab %}
{% endtabs %}

Note that updating the state of a Shipment object requires the parent order to be authorized as per order processing logic.

## Get User

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/user/:id`

Get profile information of a dashboard user

#### Path Parameters

| Name | Type   | Description            |
| ---- | ------ | ---------------------- |
| id   | string | Unique user identifier |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {
        "user": <DashboardUser>
    }
}
```

{% endtab %}
{% endtabs %}

For a full response breakdown, see [DashboardUser](/platform-api/objects.md#dashboarduser).

## Get Tenant

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/tenant`

Get information of tenant (parent) account

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {
        "tenant": <Tenant>
    },
}
```

{% endtab %}
{% endtabs %}

For a full response breakdown, see [Tenant](/platform-api/objects.md#tenant).

## Get Legal

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/settings/legal`

Get legal information of store

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {
        "legal": {
            "city": "Amman",
            "email": "hello@business.com",
            "country": "Jordan",
            "phone_no": "123",
            "license_no": "123",
            "tax_ref_no": "123",
            "address_line1": <BilingualString>,
            "address_line2": <BilingualString>,
            "business_name": <BilingualString>
        }
    },
}
```

{% endtab %}
{% endtabs %}

## Get Store Availability

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/order/available`

Get store availability (to receive new orders)

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {
        "available": true
    }
}
```

{% endtab %}
{% endtabs %}

## Override Store Availability

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/order/available`

Manually override store availability state

#### Path Parameters

| Name      | Type    | Description            |
| --------- | ------- | ---------------------- |
| available | boolean | new availability state |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {}
}
```

{% endtab %}
{% endtabs %}

## Get Webhook URL

<mark style="color:blue;">`GET`</mark> `https://api.shopgo.me/v1/management/settings/webhook/:name`

Retrieve a webhook URL

#### Path Parameters

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| name | string | Webhook name |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success",
    "payload": {
        "url": "https://microservice.com/webhooks/task"
    }
}
```

{% endtab %}
{% endtabs %}

where `name` is one of:

* `confirm-order`
* `calculate-shipping-rates`

## Change Webhook URL

<mark style="color:purple;">`PATCH`</mark> `https://api.shopgo.me/v1/management/settings/webhook/:name`

Change a webhook URL

#### Path Parameters

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| name | string | Webhook name |

#### Request Body

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| url  | string | New webhook URL |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "result": "success"
    "payload": {},
}
```

{% endtab %}
{% endtabs %}

where `name` is one of:

* `confirm-order`
* `calculate-shipping-rates`
