# Simulate acceptance of a payment request

Simulates the customer accepting an RTP in the **sandbox** environment. This is used to test success flows end-to-end (including callback delivery) without moving real funds.

***

### Request

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

```
/v2/rtp/{id}/test-accept
```

**Headers**

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

> Test RTP simulation is allowed **only in sandbox**.

#### Path Parameters

| Parameter | Type          | Required | Description                      |
| --------- | ------------- | -------- | -------------------------------- |
| `rtpId`   | string (GUID) | Yes      | RTP unique identifier (`rtpId`). |

#### Request Body Parameters

| Parameter  | Type             | Required | Description                                          |
| ---------- | ---------------- | -------- | ---------------------------------------------------- |
| `amount`   | number (decimal) | Yes      | Payment amount.                                      |
| `currency` | string (enum)    | Yes      | Payment currency. Possible values: `MDL` (ISO 4217). |

***

### Example Request

```http
POST /v2/rtp/123e4567-e89b-12d3-a456-426614174000/test-accept HTTP/1.1
Host: sandbox.maibmerchants.md
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "amount": 10,
  "currency": "MDL"
}
```

***

### Response

#### Response Parameters

| Field                 | Type                               | Description                                                                         |
| --------------------- | ---------------------------------- | ----------------------------------------------------------------------------------- |
| `result`              | object                             | Response result object.                                                             |
| `result.rtpId`        | string (GUID)                      | RTP unique identifier.                                                              |
| `result.status`       | string (enum)                      | RTP status (`Pending`, `Accepted`, `Rejected`, `Expired`, `Cancelled`, `Refunded`). |
| `result.orderId`      | string (100)                       | Merchant-side order identifier.                                                     |
| `result.payId`        | string (GUID)                      | Payment unique identifier.                                                          |
| `result.amount`       | number (decimal)                   | Payment amount.                                                                     |
| `result.commission`   | number (decimal)                   | Payment commission.                                                                 |
| `result.currency`     | string (enum)                      | Payment currency (`MDL`).                                                           |
| `result.payerName`    | string (200)                       | Payer abbreviated name.                                                             |
| `result.payerIban`    | string (100)                       | Payer IBAN.                                                                         |
| `result.executedAt`   | string (datetime, ISO 8601-1:2019) | Timestamp when the payment was executed.                                            |
| `result.signature`    | string                             | Notification validation signature.                                                  |
| `ok`                  | boolean                            | Request processing status (`true` on success).                                      |
| `errors`              | array                              | Present only if `ok = false`.                                                       |
| `errors.errorCode`    | string                             | Error code.                                                                         |
| `errors.errorMessage` | string                             | Error description.                                                                  |

#### Example Successful Response

```json
{
  "result": {
    "rtpId": "123e4567-e89b-12d3-a456-426614174000",
    "rtpStatus": "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",
    "signature": "592b6999-fdd0-4fd3-9708-5cb9df590dee"
  },
  "ok": true
}
```

***

> ### Notes
>
> * Use this endpoint to test **successful** acceptance and verify your **callback** processing and status reconciliation.
