> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cwmpay.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Payment

> Verify an INR payment using the UTR number provided by the customer.

## Endpoint

```
POST /api/merchant/payment/verify
```

## Headers

| Header         | Required | Description                |
| -------------- | -------- | -------------------------- |
| `x-api-key`    | Yes      | Your CWMPay API key        |
| `Content-Type` | Yes      | Must be `application/json` |

## Request Body

| Field      | Type     | Required | Description                               |
| ---------- | -------- | -------- | ----------------------------------------- |
| `orderId`  | `string` | Yes      | The order ID returned from Create Payment |
| `currency` | `string` | Yes      | Must be `"INR"`                           |
| `utr`      | `string` | Yes      | 12-digit UTR number provided by customer  |

## Example Request

```bash theme={null}
curl -X POST https://api.cwmpay.in/api/merchant/inr/verify \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "orderId": "CWMPay_1784798312415_04575dc339d7",
    "currency": "INR",
    "utr": "123456789012"
  }'
```

## Response

```json theme={null}
{
  "success": true,
  "message": "Payment verification successful!",
  "data": {
    "amount": 499,
    "utr": "123456789012",
    "status": "success",
    "completedAt": 1784798913288,
    "date": "27/05/2026",
    "time": "11:45:00 AM"
  }
}
```

## Response Fields

| Field         | Type      | Description                                   |
| ------------- | --------- | --------------------------------------------- |
| `amount`      | `integer` | Verified payment amount                       |
| `utr`         | `string`  | UTR number of the transaction                 |
| `status`      | `string`  | `"success"`                                   |
| `completedAt` | `integer` | Unix timestamp of payment completion          |
| `date`        | `string`  | Payment date in `DD/MM/YYYY` format (IST)     |
| `time`        | `string`  | Payment time in `HH:MM:SS AM/PM` format (IST) |

## Payment Status Flow

```
pending → processing → success
pending → expired
pending → failed
```

| Status       | Description                                |
| ------------ | ------------------------------------------ |
| `pending`    | Payment created, awaiting customer payment |
| `processing` | UTR submitted but not yet confirmed        |
| `success`    | Payment verified and confirmed             |
| `failed`     | Amount mismatch or UTR already used        |
| `expired`    | Payment not completed within 10 minutes    |

## What is UTR?

UTR (Unique Transaction Reference) is a 12-digit number generated for every UPI transaction. After paying, customers can find their UTR in:

* Their UPI app transaction history
* Bank SMS/notification
* Google Pay, PhonePe, Paytm — transaction details screen

<Info>
  CWMPay also automatically detects payments in the background every 30 seconds. You don't need to call this endpoint if you have webhooks set up — the webhook will fire automatically when payment is detected.
</Info>

## Error Responses

| Status | Message                   | Reason                                     |
| ------ | ------------------------- | ------------------------------------------ |
| `404`  | Transaction not found     | Invalid `orderId`                          |
| `401`  | Unauthorized              | Payment belongs to different merchant      |
| `409`  | Payment already verified  | Payment already in `success` state         |
| `409`  | Payment is expired/failed | Cannot verify expired or failed payment    |
| `409`  | UTR already used          | Same UTR used for another payment          |
| `422`  | Currency mismatch         | Wrong currency for this order              |
| `422`  | Amount mismatch           | Paid amount does not match expected amount |
| `410`  | Payment expired           | Payment not completed within 10 minutes    |

## Automatic Detection

CWMPay automatically scans for payments every 30 seconds. If a matching payment is found:

1. Payment status is updated to `"success"`
2. Your webhook URL receives a `payment.success` event
3. Manual verification via this endpoint is no longer needed

<Warning>
  Always implement webhook handling for production. Do not rely solely on manual UTR verification — customers may forget to submit their UTR.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Webhooks Overview" icon="webhook" href="/webhooks/overview">
    Set up automatic payment notifications
  </Card>

  <Card title="Error Reference" icon="triangle-exclamation" href="/errors">
    View all error codes
  </Card>
</CardGroup>
