> For the complete documentation index, see [llms.txt](https://docs.maibmerchants.md/checkout/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/checkout/api-reference/sandbox-simulation-environment.md).

# Sandbox (Simulation Environment)

{% hint style="info" %}
Execute successful tests according to the endpoints for the payment methods available for checkout, using [test card](#user-content-fn-1)[^1] data.
{% endhint %}

{% hint style="info" %}
When testing MIA QR payments in the sandbox environment, the payment is **not completed automatically** after the QR code is displayed on checkout.\
To complete the test payment, a manual simulation step is required.
{% endhint %}

This page describes the end-to-end flow for testing **MIA QR payments** in the **sandbox environment** when using the e-commerce checkout.

The testing flow consists of three main steps:

1. Generating a MIA QR on checkout
2. Retrieving the generated QR identifier (`qrId`)
3. Simulating the payment for the QR

***

### Step 1: Generate a MIA QR on Checkout

Start a checkout payment and select **MIA QR** as the payment method.

After clicking **Pay with MIA QR**, a QR code is displayed on the checkout page.

> &#x20;![](/files/yuHYmCwUz3X6J5tmOlUh)\
> \&#xNAN;*Example screen showing a generated MIA QR on the checkout page*

At this point:

* the QR is generated successfully
* the payment remains in a **pending** state
* no real payment is executed in sandbox

***

### Step 2: Retrieve the generated QR (`qrId`)

To simulate the payment, first retrieve the identifier of the QR generated on checkout.

1. Call the following endpoint to retrieve the list of generated QR codes:\
   <https://docs.maibmerchants.md/mia-qr-api/en/endpoints/information-retrieval-get/display-list-of-qr-codes-with-filtering-options>
2. From the response:
   * sort QR codes by **creation date**
   * identify the **latest QR**
   * copy its `qrId`

> ℹ️ **Note**\
> The latest QR by creation date corresponds to the QR currently displayed on the checkout page.

***

### Step 3: Simulate the payment for the QR

Using the retrieved `qrId`, simulate the payment according to the sandbox simulation documentation:

👉 <https://docs.maibmerchants.md/mia-qr-api/en/payment-simulation-sandbox>

For sandbox testing, use the following IBAN (as shown in the official example):

```
MD88AG000000011621810140
```

After a successful simulation:

* the payment status is updated
* the checkout flow proceeds as a **completed payment**

[^1]: Cardholder: Test Test

    Card number: 5102180060101124&#x20;

    Exp. date: 06/28&#x20;

    CVV: 760
