> For the complete documentation index, see [llms.txt](https://docs.maibmerchants.md/request-to-pay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maibmerchants.md/request-to-pay/api-reference/endpoints/create-a-new-payment-request-rtp.md).

# Create a new payment request (RTP)

This endpoint creates an individual Request to Pay (RTP), which is sent to a customer through the banking application. The RTP contains payment details such as amount, currency, description, and expiration. Once created, the customer will receive a prompt in their bank app to **accept** or **reject** the request.

### Request

**HTTP Method**: `POST`\
**Endpoint**:

```
/v2/rtp
```

**Headers**:

```http
Authorization: Bearer {access_token}
Content-Type: application/json
```

***

### Request Body Parameters

| Parameter     | Type                               | Required | Description                                                                                                   |
| ------------- | ---------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| `alias`       | string(100)                        | Yes      | Customer identification (phone number). Format: `373xxxxxxxx`. Example: `"37369112221"`.                      |
| `amount`      | number (decimal)                   | Yes      | Amount of the RTP.                                                                                            |
| `expiresAt`   | string (datetime, ISO 8601-1:2019) | Yes      | Expiration date/time of the RTP. Minimum: 1 minute, Maximum: 60 days. Example: `"2029-10-22T10:32:28+03:00"`. |
| `currency`    | string (enum)                      | Yes      | Payment currency. Possible values: `MDL`.                                                                     |
| `description` | string(500)                        | Yes      | Order description.                                                                                            |
| `orderId`     | string(100)                        | No       | Merchant’s internal order identifier.                                                                         |
| `terminalId`  | string(100)                        | No       | Terminal ID provided by the bank.                                                                             |
| `callbackUrl` | string(1000)                       | No       | HTTPS URL where the merchant will receive payment data after a successful payment.                            |
| `redirectUrl` | string(1000)                       | No       | HTTPS URL where the customer will be redirected after successful payment (for website integration).           |

***

### Example Request

```http
POST /v2/rtp HTTP/1.1
Host: api.maibmerchants.md
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "alias": "37369112221",
  "amount": 150.00,
  "expiresAt": "2029-10-22T10:32:28+03:00",
  "currency": "MDL",
  "description": "Invoice #123",
  "orderId": "INV123",
  "terminalId": "P011111",
  "callbackUrl": "https://merchant.example.com/callback",
  "redirectUrl": "https://merchant.example.com/success"
}
```

***

### Response

#### Response Parameters

| Parameter          | Type                               | Description                                                                                       |
| ------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------------- |
| `result`           | object                             | Response result object.                                                                           |
| `result.rtpId`     | string (GUID)                      | Unique identifier of the RTP.                                                                     |
| `result.orderId`   | string(100)                        | Merchant’s order identifier.                                                                      |
| `result.expiresAt` | string (datetime, ISO 8601-1:2019) | Timestamp when the RTP expires.                                                                   |
| `ok`               | boolean                            | Indicates if the request was processed successfully (`true`).                                     |
| `errors`           | array                              | List of errors, present only if `ok = false`. Each error contains `errorCode` and `errorMessage`. |

***

#### Example Successful Response

```json
{
  "result": {
    "rtpId": "123e4567-e89b-12d3-a456-426614174000",
    "orderId": "INV123",
    "expiresAt": "2029-10-22T10:32:28+03:00"
  },
  "ok": true
}
```

***

### Notes

* A new RTP is created in **Pending** status.
* If not accepted or rejected by the customer before `expiresAt`, it will automatically move to **Expired**.
* The `rtpId` returned in the response is required for all subsequent operations (checking status, cancelling, refunding).
