# Order

## Module endpoints

* ​[`GET /orders`](#get-invites)​
* ​[`GET /orders/:id`](#get-orders-id)​
* ​[`GET /orders/:orderId/lines`](#get-invites-1)​
* [`GET /orders/:orderId/lines/:id`](#get-orders-orderid-lines-id)​
* ​[`PATCH /orders/:id`](#patch-orders-id)​
* ​[`POST /orders`](#post-orders)​
* [`POST /orders/:id/cancel`](#post-orders-id-cancel)
* [`POST /orders/:id/fulfill`](#post-orders-id-fulfill)
* [`POST /orders/:id/pay`](#post-orders-id-pay)
* [`POST /orders/:id/unfulfill`](#post-orders-id-unfulfill)
* [`POST /orders/:orderId/lines/:id/fulfill`](#get-invites-2)
* [`POST /orders/:orderId/lines/:id/unfulfill`](#get-invites-3)

### `GET /orders` <a href="#get-invites" id="get-invites"></a>

> `GET` <https://api.slyk.i&#x6F;**/orders>\*\*

Returns a paginated list of `orders`.

{% tabs %}
{% tab title="Available Filters" %}

| Name              |                              Type                             | Example                                                   |
| ----------------- | :-----------------------------------------------------------: | --------------------------------------------------------- |
| **amount**        | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[amount]=gte:2.50`                                 |
| **assetCode**     |                         `=` `in` `nin`                        | `filter[assetCode]=foo`                                   |
| **bonus**         | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[bonus]=lte:0.40`                                  |
| **fulfilledAt**   | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[fulfilledAt]=lt:2020-08-10T10:00:00.000Z`         |
| **hideDrafts**    |                            `custom`                           | `filter[hideDrafts]=true`                                 |
| **orderStatus**   |                         `=` `in` `nin`                        | `filter[orderStatus]=fulfilled`                           |
| **paidAmount**    | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[paidAmount]=2.50`                                 |
| **paidAt**        | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[paidAmount]=gte:2020-08-10T10:00:00.000Z`         |
| **paymentStatus** |                         `=` `in` `nin`                        | `filter[paymentStatus]=fully_paid`                        |
| **reference**     |                         `=` `in` `nin`                        | `filter[reference]=foo`                                   |
| **trackingId**    |                         `=` `in` `nin`                        | `filter[trickingId]=7938e446-1c77-4513-8cb0-8b1f2e9f47b8` |
| **userId**        |                         `=` `in` `nin`                        | `filter[userId]=7938e446-1c77-4513-8cb0-8b1f2e9f47b9`     |
| {% endtab %}      |                                                               |                                                           |

{% tab title="Available Sorts" %}

| Name            | Example                                                                |
| --------------- | ---------------------------------------------------------------------- |
| **canceledAt**  | <p><code>sort=canceledAt</code><br><code>sort=-canceledAt</code></p>   |
| **createdAt**   | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p>     |
| **fulfilledAt** | <p><code>sort=fulfilledAt</code><br><code>sort=-fulfilledAt</code></p> |
| **paidAt**      | <p><code>sort=paidAt</code><br><code>sort=-paidAt</code></p>           |
| {% endtab %}    |                                                                        |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "amount": "7.00000000",
      "amountWithoutShipment": "6.00000000",
      "amountWithoutTaxes": "6.10000000",
      "assetCode": "eur",
      "bonus": "1.00000000",
      "bonusAssetCode": "eur",
      "canceledAt": null,
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "deliveryMethod": "shipping",
      "fulfilledAt": null,
      "id": "7938e446-1c77-4513-8cb0-8b1f2e9f47b1",
      "metadata": {
        "deliveryMethod": "shipping",
        "shippingAmount": "1.00000000",
        "taxesAmount": "0.9000000"
      },
      "orderStatus": "unfulfilled",
      "paidAmount": "0.00000000",
      "paidAt": null,
      "paymentStatus": "unpaid",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000",
      "trackingId": null,
      "unpaidAmount": "7.00000000",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "user": {
        "approved": true,
        "email": "waldo@foobar.com",
        "id": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9",
        "imageUrl": "http://slyk.io/waldo-user.png",
        "metadata": {},
        "name": "waldo"
      },
      "userId": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9"
    },
    {
      "amount": "8.00000000",
      "amountWithoutShipment": "7.20000000",
      "amountWithoutTaxes": "7.50000000",
      "assetCode": "eur",
      "bonus": "1.20000000",
      "bonusAssetCode": "eur",
      "canceledAt": null,
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "deliveryMethod": "shipping",
      "fulfilledAt": null,
      "id": "7938e446-1c77-4513-8cb0-8b1f2e9f47b0",
      "metadata": {
        "deliveryMethod": "shipping",
        "shippingAmount": "0.80000000",
        "taxesAmount": "0.5000000"
      },
      "orderStatus": "fulfilled",
      "paidAmount": "1.30000000",
      "paidAt": null,
      "paymentStatus": "fully_refunded",
      "shippingAmount": "0.80000000",
      "taxesAmount": "0.5000000"
      "trackingId": null,
      "unpaidAmount": "6.70000000",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "user": {
        "approved": true,
        "email": "fred@foobar.com",
        "id": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9",
        "imageUrl": "http://slyk.io/fred-user.png",
        "metadata": {},
        "name": "fred"
      },
      "userId": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9"
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /orders/:id`

> `GET` <https://api.slyk.i&#x6F;**/orders/:id**‌>

Gets the order details of the given `id`.

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

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": null,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c6",
    "lines": [{
      "assetCode": "eur",
      "bonusAssetCode": "eur",
      "createdAt": "2020-08-10T11:00:00.000Z",
      "fulfilledAt": null,
      "fulfilledQuantity": 1,
      "metadata": {},
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c1",
      "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c6",
      "product": {
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2",
        "name": "Music t-shirt"
      },
      "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2",
      "quantity": 2,
      "status": "unfulfilled",
      "unitBonus": "0.50000000",
      "unitPrice": "3.50000000",
      "updatedAt": "2020-08-10T12:00:00.000Z"
    }],
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "unfulfilled",
    "paidAmount": "0.00000000",
    "paidAt": null,
    "paymentStatus": "unpaid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": null,
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T10:00:00.000Z",
    "user": {
      "approved": true,
      "email": "waldo@foobar.com",
      "id": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9",
      "imageUrl": "http://slyk.io/waldo-user.png",
      "metadata": {},
      "name": "waldo"
    },
    "userId": "7938e446-1c77-4513-8cb0-8b1f2e9f47b9"
  }
}
```

{% endtab %}
{% endtabs %}

### `GET /orders/:orderId/lines` <a href="#get-invites" id="get-invites"></a>

> `GET` <https://api.slyk.i&#x6F;**/orders/:id/lines>\*\*

Returns a paginated list of `order lines`.

{% tabs %}
{% tab title="Available Filters" %}

| Name                  |                              Type                             | Example                                      |
| --------------------- | :-----------------------------------------------------------: | -------------------------------------------- |
| **assetCode**         |                         `=` `in` `nin`                        | `filter[assetCode]=foo`                      |
| **fulfilledAt**       | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[bonus]=lte:2019-08-10T10:00:00.000Z` |
| **fulfilledQuantity** | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[fulfilledQuantity]=gt:2`             |
| **quantity**          | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[quantity]=5`                         |
| **status**            |                         `=` `in` `nin`                        | `filter[status]=unfulfilled`                 |
| **unitPrice**         | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[unitPrice]=2.15`                     |
| {% endtab %}          |                                                               |                                              |

{% tab title="Available Sorts" %}

| Name            | Example                                                                |
| --------------- | ---------------------------------------------------------------------- |
| **createdAt**   | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p>     |
| **fulfilledAt** | <p><code>sort=fulfilledAt</code><br><code>sort=-fulfilledAt</code></p> |
| {% endtab %}    |                                                                        |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "assetCode": "eur",
      "bonusAssetCode": "eur",
      "createdAt": "2020-08-10T11:00:00.000Z",
      "fulfilledAt": null,
      "fulfilledQuantity": 1,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "metadata": {},
      "order": {
        "amount": "1.00000000",
        "assetCode": "eur",
        "bonus": "0.00000000",
        "bonusAssetCode": "eur",
        "canceledAt": null,
        "createdAt": "2020-08-10T10:00:00.000Z",
        "customData": {},
        "fulfilledAt": null,
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
        "metadata": {},
        "orderStatus": "unfulfilled",
        "paidAmount": "0.00000000",
        "paidAt": null,
        "paymentStatus": "unpaid",
        "trackingId": "ec78d28f-a8dd-49de-a22f-722fe3bd26c4",
        "updatedAt": "2020-08-10T12:00:00.000Z"
        "userId": "waldo"
      },
      "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
      "product": {
        "category": {
          "customData": {},
          "description": "Music related things",
          "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
          "imageUrl": null,
          "metadata": {},
          "thumbnailUrl": null,
          "title": "Music"
        },
        "customData": {},
        "description": null,
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
        "image": null,
        "metadata": {},
        "name": "Music t-shirt",
        "thumbnail": null,
        "typeCode": "digital"
      },
      "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "quantity": 2,
      "status": "unfulfilled",
      "unitBonus": "0.00000000",
      "unitPrice": "0.50000000",
      "updatedAt": "2020-08-10T12:00:00.000Z"
    },
    {
      "assetCode": "eur",
      "bonusAssetCode": "eur",
      "createdAt": "2020-08-10T11:00:00.000Z",
      "fulfilledAt": null,
      "fulfilledQuantity": 1,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c9",
      "metadata": {},
      "order": {
        "amount": "1.00000000",
        "assetCode": "eur",
        "bonus": "0.00000000",
        "bonusAssetCode": "eur",
        "canceledAt": null,
        "createdAt": "2020-08-10T10:00:00.000Z",
        "customData": {},
        "fulfilledAt": null,
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c1",
        "metadata": {},
        "orderStatus": "unfulfilled",
        "paidAmount": "0.00000000",
        "paidAt": null,
        "paymentStatus": "unpaid",
        "trackingId": "ec78d28f-a8dd-49de-a22f-722fe3bd26c1",
        "updatedAt": "2020-08-10T12:00:00.000Z"
        "userId": "waldo"
      },
      "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c1",
      "product": {
        "category": {
          "customData": {},
          "description": "Music related things",
          "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
          "imageUrl": null,
          "metadata": {},
          "thumbnailUrl": null,
          "title": "Music"
        },
        "customData": {},
        "description": null,
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
        "image": null,
        "metadata": {},
        "name": "Music t-shirt",
        "thumbnail": null,
        "typeCode": "digital"
      },
      "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "quantity": 4,
      "status": "unfulfilled",
      "unitBonus": "0.00000000",
      "unitPrice": "0.25000000",
      "updatedAt": "2020-08-10T12:00:00.000Z"
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /orders/:orderId/lines/:id`

> `GET` <https://api.slyk.i&#x6F;**/orders/:orderId/lines/:id**‌>

Gets the order line details of the given `id` on the order with the given `orderId`.

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

```javascript
{
  "data": {
    "assetCode": "eur",
    "bonusAssetCode": "eur",
    "createdAt": "2020-08-10T11:00:00.000Z",
    "fulfilledAt": null,
    "fulfilledQuantity": 1,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {},
    "order": {
      "amount": "1.00000000",
      "assetCode": "eur",
      "bonus": "0.00000000",
      "bonusAssetCode": "eur",
      "canceledAt": null,
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "fulfilledAt": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
      "metadata": {},
      "orderStatus": "unfulfilled",
      "paidAmount": "0.00000000",
      "paidAt": null,
      "paymentStatus": "unpaid",
      "trackingId": "ec78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "updatedAt": "2020-08-10T12:00:00.000Z"
      "userId": "waldo"
    },
    "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "product": {
      "category": {
        "customData": {},
        "description": "Music related things",
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
        "imageUrl": null,
        "metadata": {},
        "thumbnailUrl": null,
        "title": "Music"
      },
      "customData": {},
      "description": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "image": null,
      "metadata": {},
      "name": "Music t-shirt",
      "thumbnail": null,
      "typeCode": "digital"
    },
    "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
    "quantity": 2,
    "status": "unfulfilled",
    "unitBonus": "0.00000000",
    "unitPrice": "0.50000000",
    "updatedAt": "2020-08-10T12:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `PATCH /orders/:id`

> `PATCH` <https://api.slyk.i&#x6F;**/order/:id>\*\*

Patches the `order` details of the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field          |   Type   | Required | Description                                |
| -------------- | :------: | :------: | ------------------------------------------ |
| **trackingId** | `string` |  `false` | Order tracking identifier. Format: `uuid`. |
| {% endtab %}   |          |          |                                            |

{% tab title="Request" %}

```javascript
{
  "trackingId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": null,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "unfulfilled",
    "paidAmount": "0.00000000",
    "paidAt": null,
    "paymentStatus": "unpaid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T11:00:00.000Z"
    "userId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders`

> `POST` <https://api.slyk.i&#x6F;**/orders>\*\*

Creates a new `order`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field                   |        Type        | Required | Description                                                                                           |
| ----------------------- | :----------------: | :------: | ----------------------------------------------------------------------------------------------------- |
| **chosenPaymentMethod** |      `string`      |  `false` | Order chosen payment method. This value is merely indicative.                                         |
| **customData**          |      `object`      |  `false` | Can store any additional information about the order.                                                 |
| **deliveryMethod**      |      `string`      |  `false` | Available delivery methods: *shipping* or *pickup*                                                    |
| **dryRun**              |      `boolean`     |  `false` | Dry run flag. If true, the order creation won't be committed. (default: false)                        |
| **lines**               | `Array<OrderLine>` |  `true`  | Order lines. The order line request parameters are defined on the next table.                         |
| **shippingAddressId**   |      `string`      |  `false` | Shipping address identification. This attribute is required if *delivery method* is set to *shipping* |
| **useBonus**            |      `boolean`     |  `false` | Flag to indicate if it should use bonus balance to pay the order. (default: false)                    |
| **userId**              |      `string`      |  `true`  | Associated user identifier. Format: `uuid`.                                                           |
| **userNotes**           |      `string`      |  `false` | Order user notes.                                                                                     |
| **walletId**            |      `string`      |  `false` | Wallet id from where the payment should be performed immediately.                                     |

Order line request parameters:

| Field                      |    Type   | Required | Description                                    |
| -------------------------- | :-------: | :------: | ---------------------------------------------- |
| **productId**              |  `string` |  `true`  | Associated product identifier. Format: `uuid`. |
| **productQuestionsResult** |  `object` |  `false` | Order line questions result.                   |
| **quantity**               | `integer` |  `false` | Order line quantity.                           |
| {% endtab %}               |           |          |                                                |

{% tab title="Request" %}

```javascript
{
  "deliveryMethod": "shipping",
  "lines": [{
    "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
    "quantity": 2
  },
  {
    "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c6",
    "quantity": 2
  }],
  "useBonus": true,
  "userId": "88b1a9a6-a35c-4938-868a-396e468e592b"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": null,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "unfulfilled",
    "paidAmount": "0.00000000",
    "paidAt": null,
    "paymentStatus": "unpaid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": null,
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T11:00:00.000Z"
    "userId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders/:id/cancel`

> `POST` <http://api.slyk.i&#x6F;**/orders/:id/cancel>\*\*

Cancels the `order` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field            |                         Type                        | Required | Description                |
| ---------------- | :-------------------------------------------------: | :------: | -------------------------- |
| **reason**       | <p><code>string</code></p><p><code>array</code></p> |  `false` | Order cancel reason.       |
| **refundAmount** |                       `string`                      |  `false` | Order refund amount value. |
| {% endtab %}     |                                                     |          |                            |

{% tab title="Request" %}

```javascript
{
  "reason": "foo",
  "refundAmount": "2.5000000"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `POST /orders/:id/fulfill`

> `POST` <http://api.slyk.i&#x6F;**/orders/:id/fulfill>\*\*

Fulfills the `order` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field          |   Type   | Required | Description                                |
| -------------- | :------: | :------: | ------------------------------------------ |
| **trackingId** | `string` |  `false` | Order tracking identifier. Format: `uuid`. |
| {% endtab %}   |          |          |                                            |

{% tab title="Request" %}

```javascript
{
  "trackingId": "7938e446-1c77-4513-8cb0-8b1f2e9f47b4"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": "2020-08-10T11:00:00.000Z",
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "fulfilled",
    "paidAmount": "0.00000000",
    "paidAt": null,
    "paymentStatus": "unpaid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": null,
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T11:00:00.000Z"
    "userId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders/:id/pay`

> `POST` <http://api.slyk.i&#x6F;**/orders/:id/pay>\*\*

Pays the `order` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field        |   Type   | Required | Description                                   |
| ------------ | :------: | :------: | --------------------------------------------- |
| **amount**   | `string` |  `false` | Amount to pay.                                |
| **walletId** | `string` |  `false` | Associated wallet identifier. Format: `uuid`. |
| {% endtab %} |          |          |                                               |

{% tab title="Request" %}

```javascript
{
  "amount": "0.0000007",
  "walletId": "7938e446-1c77-4513-8cb0-8b1f2e9f47b4"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": "2020-08-10T11:00:00.000Z",
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "fulfilled",
    "paidAmount": "7.00000000",
    "paidAt": "2020-08-10T12:00:00.000Z",
    "paymentStatus": "paid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": null,
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T12:00:00.000Z"
    "userId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders/:id/unfulfill`

> `POST` <http://api.slyk.i&#x6F;**/orders/:id/unfulfill>\*\*

Unfulfills the `order` with the given `id`.

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

```javascript
{
  "data": {
    "amount": "7.00000000",
    "amountWithoutShipment": "6.00000000",
    "amountWithoutTaxes": "6.10000000",
    "assetCode": "eur",
    "bonus": "1.00000000",
    "bonusAssetCode": "eur",
    "canceledAt": null,
    "createdAt": "2020-08-10T10:00:00.000Z",
    "customData": {},
    "deliveryMethod": "shipping",
    "fulfilledAt": null,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {
      "deliveryMethod": "shipping",
      "shippingAmount": "1.00000000",
      "taxesAmount": "0.9000000"
    },
    "orderStatus": "unfulfilled",
    "paidAmount": "7.00000000",
    "paidAt": "2020-08-10T12:00:00.000Z",
    "paymentStatus": "paid",
    "shippingAmount": "1.00000000",
    "taxesAmount": "0.9000000",
    "trackingId": null,
    "unpaidAmount": "7.00000000",
    "updatedAt": "2020-08-10T12:00:00.000Z"
    "userId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c2"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders/:orderId/lines/:id/fulfill` <a href="#get-invites" id="get-invites"></a>

> `POST` <http://api.slyk.i&#x6F;**/orders/:orderId/lines/:id/fulfill>\*\*

Fulfills the `order line` with the given `id` on the order with the given `orderId`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field        |    Type   | Required | Description          |
| ------------ | :-------: | :------: | -------------------- |
| **quantity** | `integer` |  `false` | Order line quantity. |
| {% endtab %} |           |          |                      |

{% tab title="Request" %}

```javascript
{
  "quantity": 1
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "assetCode": "eur",
    "bonusAssetCode": "eur",
    "createdAt": "2020-08-10T11:00:00.000Z",
    "fulfilledAt": "2020-08-10T12:00:00.000Z",
    "fulfilledQuantity": 1,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {},
    "order": {
      "amount": "1.00000000",
      "assetCode": "eur",
      "bonus": "0.00000000",
      "bonusAssetCode": "eur",
      "canceledAt": null,
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "fulfilledAt": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
      "metadata": {},
      "orderStatus": "unfulfilled",
      "paidAmount": "0.00000000",
      "paidAt": null,
      "paymentStatus": "unpaid",
      "trackingId": "ec78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "updatedAt": "2020-08-10T12:00:00.000Z"
      "userId": "waldo"
    },
    "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "product": {
      "category": {
        "customData": {},
        "description": "Music related things",
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
        "imageUrl": null,
        "metadata": {},
        "thumbnailUrl": null,
        "title": "Music"
      },
      "customData": {},
      "description": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "image": null,
      "metadata": {},
      "name": "Music t-shirt",
      "thumbnail": null,
      "typeCode": "digital"
    },
    "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
    "quantity": 1,
    "status": "fulfilled",
    "unitBonus": "0.00000000",
    "unitPrice": "1.00000000",
    "updatedAt": "2020-08-10T12:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /orders/:orderId/lines/:id/unfulfill` <a href="#get-invites" id="get-invites"></a>

> `POST` <http://api.slyk.i&#x6F;**/orders/:orderId/lines/:id/unfulfill>\*\*

Unfulfills the `order line` with the given `id` on the order with the given `orderId`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field        |    Type   | Required | Description          |
| ------------ | :-------: | :------: | -------------------- |
| **quantity** | `integer` |  `false` | Order line quantity. |
| {% endtab %} |           |          |                      |

{% tab title="Request" %}

```javascript
{
  "quantity": 1
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "assetCode": "eur",
    "bonusAssetCode": "eur",
    "createdAt": "2020-08-10T11:00:00.000Z",
    "fulfilledAt": null,
    "fulfilledQuantity": 0,
    "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
    "metadata": {},
    "order": {
      "amount": "1.00000000",
      "assetCode": "eur",
      "bonus": "0.00000000",
      "bonusAssetCode": "eur",
      "canceledAt": null,
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "fulfilledAt": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
      "metadata": {},
      "orderStatus": "unfulfilled",
      "paidAmount": "0.00000000",
      "paidAt": null,
      "paymentStatus": "unpaid",
      "trackingId": "ec78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "updatedAt": "2020-08-10T12:00:00.000Z"
      "userId": "waldo"
    },
    "orderId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c7",
    "product": {
      "category": {
        "customData": {},
        "description": "Music related things",
        "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
        "imageUrl": null,
        "metadata": {},
        "thumbnailUrl": null,
        "title": "Music"
      },
      "customData": {},
      "description": null,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "image": null,
      "metadata": {},
      "name": "Music t-shirt",
      "thumbnail": null,
      "typeCode": "digital"
    },
    "productId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
    "quantity": 1,
    "status": "unfulfilled",
    "unitBonus": "0.00000000",
    "unitPrice": "1.00000000",
    "updatedAt": "2020-08-10T12:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}
