> For the complete documentation index, see [llms.txt](https://w3block.gitbook.io/w3block-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://w3block.gitbook.io/w3block-eng/dev-docs/api/commerce-api-services/company-administration/orders-admin.md).

# Orders (Admin)

Orders are always created by some user who want to purchase some product. So, in terms of order administration, we only have data visualisation and the possibility to cancel or force deliver of some order.

<details>

<summary>Order Model (Example)</summary>

```json
{
  "id": "string",
  "createdAt": "2022-11-04T12:56:48.255Z",
  "updatedAt": "2022-11-04T12:56:48.255Z",
  "companyId": "string",
  "userId": "string",
  "destinationWalletAddress": "string",
  "addressId": "string",
  "address": null,
  "currencyId": "string",
  "currencyAmount": "string",
  "products": [
    ...
  ],
  "status": "pending",
  "paymentProvider": "pagar_me",
  "providerTransactionId": "za_1012skak1",
  "paymentMethod": "credit_card",
  "paymentInfo": {
    "paymentUrl": "https://example.com/order/1/pay"
  },
  "deliverDate": "2022-11-04T12:56:48.255Z",
  "expiresIn": "2022-11-04T12:56:48.255Z",
  "gasFee": "string",
  "clientServiceFee": "string",
  "companyServiceFee": "string",
}
```

</details>

## Solving failed orders

When we have some kind of trouble in the token transfer, the order will be moved to a "failed" status. With that status, an administrator need to solve this fail situation with 2 alternatives:

* **Cancel the order:** It will cancel the order payment and unlock the order product to be purchased again from an other user
* **Try to deliver again:** The system will retry product deliver. It is very common to do if the operator wallet address of the company have no funds to transfer token when the order failed.

## Service Methods

### Lists all company orders

Rest API reference:

{% openapi src="<https://commerce.pixway.io/sdk-json>" path="/admin/companies/{companyId}/orders" method="get" %}
<https://commerce.pixway.io/sdk-json>
{% endopenapi %}

### Cancels some company order

Rest API reference:

{% openapi src="<https://commerce.pixway.io/sdk-json>" path="/admin/companies/{companyId}/orders/{orderId}/cancel" method="patch" %}
<https://commerce.pixway.io/sdk-json>
{% endopenapi %}

### Force deliver of some company order (it will also force a deliver retry)

Rest API reference:

{% openapi src="<https://commerce.pixway.io/sdk-json>" path="/admin/companies/{companyId}/orders/{orderId}/force-deliver" method="patch" %}
<https://commerce.pixway.io/sdk-json>
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://w3block.gitbook.io/w3block-eng/dev-docs/api/commerce-api-services/company-administration/orders-admin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
