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

# Create an order

An order is created when a payer wants to make a payment using Wagent. You can create an order by calling the following endpoint:

**POST /orders**

**Request Body:**

```json
{
  "products": [
    {
      "name": "Macbook M1",
      "logo": "https://bing.com/1.jpg",
      "amount": 2000,
      "count": 5
    }
  ],
  "amount": 1000,
  "redirectUrl": "http://yourshop.com/some_unique_id_for_each_order"
}
```

**Headers:**

```
apiKey: YOUR_API_KEY
```

{% hint style="info" %}
You should provide either `amount` or `products`. If you have a complete product list, use the `products` field, and the total amount will be calculated based on each product's count and price. If the product list is not available, you can simply enter the `amount` and specify the price in USD.
{% endhint %}

{% hint style="info" %}
The `redirectUrl` is used to redirect the payer after the payment has been completed or if the payment is canceled.
{% endhint %}

**Successful Response:**

If everything goes well, the API will return the following response:

**Status:** 200

**Response Body:**

```json
{
  "message": "Order has been created",
  "result": {
    "id": "66f233c4a1762f8f665e02e7",
    "url": "https://pay.wagent.app/66f233c4a1762f8f665e02e7"
  }
}
```

This response confirms that the order has been successfully created, providing the order ID and a URL for payment.

Now, you can redirect the payer to the `response.result.url`
