# Generate OTP

**Method:** `POST`

**Path:** `/api/pay/v1/otp/generate`

**Category:** Card Payments

**Authentication:** Required

## Description

Generate a One-Time Password (OTP) for card payment authentication.
This API is called after a card payment is created and the card requires
OTP-based verification (native OTP flow).


## Request Body

Content-Type: `application/json`

- `payment_id` (`string`) **required** — Unique identifier of the payment requiring OTP verification.

### Example Request

```json
{
  "payment_id": "v1-5757575757-aa-hU1rUd-cc-l"
}
```

## Responses

- `200` — OTP generated successfully.
- `400` — 
- `422` — Unprocessable entity — payment not eligible for OTP generation.
- `500` — 
- `503` — Service temporarily unavailable.

### Response Schema

- `next` (`string[]`) — Available next actions.
- `meta_data` (`object`) — Additional metadata for OTP handling.
  - `resend_after` (`string`) — Minimum wait time in seconds before OTP can be resent.


### Example Response

```json
{
  "next": [
    "SUBMIT_OTP",
    "RESEND_OTP"
  ],
  "meta_data": {
    "resend_after": "180"
  }
}
```

---

Reference: https://localhost:3000/api/card-payments/generate-otp
