# Payment Simulation (Sandbox)

### **POST**`/v2/mia/test-pay`

Payment simulation is allowed exclusively in the sandbox environment (testing). This endpoint allows testing the payment process by sending a payload with payment details.

***

#### Request

Method: `POST`

URL: `/v2/mia/test-pay`

***

#### Request Parameters (body JSON)

| Parameter   | Type             | Required | Description                               |
| ----------- | ---------------- | -------- | ----------------------------------------- |
| `qrId`      | string (guid)    | Yes      | Unique identifier of the QR code          |
| `amount`    | number (decimal) | Yes      | Payment amount                            |
| `iban`      | string(100)      | Yes      | Payer's IBAN                              |
| `currency`  | string (enum)    | Yes      | Payment currency (possible values: `MDL`) |
| `payerName` | string(200)      | Yes      | Short name of the payer                   |

#### Request example

```json
{
  "qrId": "123e4567-e89b-12d3-a456-426614174000",
  "amount": 10,
  "iban": "MD88AG000000011621810140",
  "currency": "MDL",
  "payerName": "John D."
}
```

***

#### Response parameters

#### `result`

**Type:** `object`\
Object containing the response result.

***

#### Fields of the object `result`

| Field          | Type             | Description                                                                                           |
| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------- |
| `qrId`         | string(guid)     | Unique identifier of the QR code.                                                                     |
| `qrStatus`     | string(enum)     | Status of the QR code. Possible values: `Active`, `Inactive`, `Expired`, `Paid`, `Cancelled`.         |
|                |                  | **Active** – Status for an active QR code.                                                            |
|                |                  | **Inactive** – Status for a Static or Hybrid QR if no payment has been made in the last 30 days.      |
|                |                  | **Expired** – Status for a Dynamic or Hybrid QR if the validity period has expired without a payment. |
|                |                  | **Paid** – Status for a Dynamic or Hybrid QR after a payment has been made.                           |
|                |                  | **Cancelled** – Status after a cancel request (`POST /v2/mia/qr/{qrId}/cancel`).                      |
| `orderId`      | string(100)      | Order identifier from the merchant side.                                                              |
| `payId`        | string(guid)     | Unique identifier of the payment.                                                                     |
| `amount`       | number(decimal)  | Payment amount.                                                                                       |
| `commission`   | number(decimal)  | Fee charged for the payment.                                                                          |
| `currency`     | string(enum)     | Currency in which the payment was made. Possible values: `MDL`. Format: ISO 4217.                     |
| `payerName`    | string(200)      | Abbreviated name of the payer.                                                                        |
| `payerIban`    | string(100)      | IBAN of the payer (International Bank Account Number).                                                |
| `executedAt`   | string(datetime) | Date and time when the payment was executed. Format: ISO 8601-1:2019.                                 |
| `signatureKey` | string           | Signature key for validating the notification.                                                        |

***

#### Other Response Fields

| Field    | Type    | Description                                                                                                                                            |
| -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ok`     | boolean | Request processing status – `true` means no errors; `false` means an error occurred (see [`errors`](broken://pages/bh34rqvaDjWUk4pJERVf) for details). |
| `errors` | array   | List of errors encountered while processing the request.                                                                                               |

**Objects in `errors`**

| Field          | Type   | Description                                 |
| -------------- | ------ | ------------------------------------------- |
| `errorCode`    | string | The specific code of the encountered error. |
| `errorMessage` | string | Detailed description of the error.          |

#### Response example

```json
{
  "result": {
    "qrId": "123e4567-e89b-12d3-a456-426614174000",
    "qrStatus": "Active",
    "orderId": "123",
    "payId": "6d24e4a5-c6bf-4d3e-bf7a-8d2123faf4e9",
    "amount": 10,
    "commission": 2.50,
    "currency": "MDL",
    "payerName": "John D.",
    "payerIban": "MD88AG000000011621810140",
    "executedAt": "2024-11-29T10:56:52.1380956+00:00",
    "signatureKey": "592b6999-fdd0-4fd3-9708-5cb9df590dee"
  },
  "ok": true
}
```

***

#### Notes&#x20;

* This endpoint is available **only in the sandbox environment** for testing.
* If `ok` is `false`, the `errors` field will contain details about the issues encountered.
* The `qrStatus` value reflects the **current status of the QR code** after the payment simulation.
* The signature key in the `result.signatureKey` field must be verified **according to the algorithm** defined in the [callback (notification)](broken://pages/5JyINtc6r1zwzw0ok2DM) documentation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maibmerchants.md/mia-qr-api/en/payment-simulation-sandbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
