# Payment Status

**Payment Status Endpoint:**

This endpoint is useful for initiating payments with a custom UPI Intent and redirecting customers after they complete the payment.

```bash
POST /v1/payments/checkPaymentStatus
```

#### Code Example: Axios POST Request

Below is an example of how to use Axios to check payment status:

```javascript
await axios.post(
  "https://api.upitranzact.com/v1/payments/checkPaymentStatus",
  {
    mid: "Your Merchant ID", // Example: ABC
    order_id: "Your order ID", // Example: bd79da4cc3ff1
  },
  {
    headers: {
      Authorization: "Basic base64(public_key:secret_key)"
    }
  }
);
```

#### Key Points

* **mid**: Your merchant identifier.
* **order\_id**: A unique string for transaction tracking.
* **Authorization**: Basic base64(public\_key:secret\_key).

Ensure all placeholders (e.g., "Your Merchant ID") are replaced with actual values before executing

**Request Body Parameters:**

<mark style="color:green;">`POST`</mark> `/v1/payments/checkPaymentStatus`

**Headers**

| Name          | Value                               |
| ------------- | ----------------------------------- |
| Content-Type  | `application/x-www-form-urlencoded` |
| Authorization | `Basic Auth`                        |

**Body**

<table><thead><tr><th width="203">Name</th><th width="90">Type</th><th width="214">Description</th><th width="135">Example Value</th><th>Required</th></tr></thead><tbody><tr><td><code>mid</code></td><td>string</td><td>Merchant ID assigned to you by UPITranzact.</td><td>ABC</td><td>Yes</td></tr><tr><td><code>order_id</code></td><td>string</td><td>A unique identifier for the order.</td><td>bd79da4cccff1</td><td>Yes</td></tr></tbody></table>

**Authorization:**

The request must include an **Authorization header** with a **Base64 encoded string** containing your `public_key` and `secret_key` in the format `public_key:secret_key`. Here's an example of how to generate the **Authorization header**:

**Example:**

```javascript
Authorization: "Basic base64(public_key:secret_key)"
```

For example, if your `public_key` is `your_public_key` and your `secret_key` is `your_secret_key`, you would encode this into Base64 and use it as the Authorization header.

**Example Authorization Header (Base64 encoded):**

```javascript
Authorization: "Basic eW91cl9wdWJsaWNfa2V5OnlvdXJfc2VjcmV0X2tleQ=="
```

**Response**

{% tabs %}
{% tab title="200" %}
```json
{
    "status": true,
    "statusCode": 200,
    "msg": "Transaction is successful",
    "data": {
        "amount": 1,
        "UTR": "502002472504",
        "order_id": "utz_xxxxxxx"
    }
}
```
{% endtab %}

{% tab title="404" %}
```json
{
    "status": false,
    "statusCode": 404,
    "msg": "Transaction not found"
}
```
{% endtab %}
{% endtabs %}

**Error Codes:**

* **400**: Bad Request - Missing required parameters or invalid data.
* **401**: Unauthorized - Invalid or missing `Authorization` Basic Auth.
* **404**: Not Found - An issue occurred on the server side.
* **409**: Conflict - The request could not be processed due to a conflict with the current state of the resource.
* **500**: Internal Server Error - An issue occurred on the server side.
