> For the complete documentation index, see [llms.txt](https://zrpl-co-1.gitbook.io/zrpl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zrpl-co-1.gitbook.io/zrpl/reference/api-reference/place-order.md).

# Place Order

This API is offering to Place  Simple Order.

<mark style="color:green;">`POST`</mark> {{Base\_url}}`/rest/V1/carts/mine/payment-information`

This API is used to **place an order** in Magento by submitting the payment details and finalizing the cart as an order. It transitions the shopping cart to an order and assigns an order entity ID.

**Body**

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

```json
{
  "paymentMethod": {
    "method": "{{payment_method}}"
  }
}
```

{% endtab %}
{% endtabs %}

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

```javascript
curl --location '{{Base_url}}/rest/V1/carts/mine/payment-information' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc1MzczODUsImV4cCI6MTczNzU0MDk4NX0.l_L_v__xKmNkdXidfiI6AZsQ9pWMJMDUtjFJDKQwDnU' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
  "paymentMethod": {
    "method": "{{payment_method}}"
  }
}
'
```

{% endtab %}
{% endtabs %}

The given cURL command is an API request to the Magento 2 platform for placing an order in a customer's shopping cart using the specified payment method. This request finalizes the cart and generates an order based on the cart details, shipping information, and payment method.

**Attributes in Payload**

1. **`paymentMethod`**:
   * An object that defines the payment method for the order.
2. **`method`**:
   * Value: `"`{{payment\_method}}`"`
   * Specifies the code of the payment method being used.
   * Common values include:
     * `"cashondelivery"` for Cash on Delivery.
     * `"cashfree"` for Cashfree payment gateway.
     * `"razorpay"` for Razorpay payment gateway.

***

#### **Purpose of the API**

1. **Places the Order**:
   * Finalizes the current cart (`mine`) by associating it with the payment method.
   * Converts the cart into a confirmed order in Magento.
2. **Processes Payment**:
   * Initiates the payment process with the selected payment gateway (payment\_method).
3. **Generates Order ID**:
   * On success, the API responds with an **order ID** confirming the order placement.

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

```json
237161
```

{% endtab %}
{% endtabs %}

The response `237161` indicates that the order has been successfully placed, and the number represents the **Entity ID.**

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

```javascript
{
    "message": "Current customer does not have an active cart."
}
```

{% endtab %}

{% tab title="Invalid Token Passed 401 " %}

```postman_json
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
```

{% endtab %}
{% endtabs %}
