# Endpoints Overview

The Request to Pay (RTP) API provides a set of endpoints that allow merchants to create payment requests, manage their lifecycle, and simulate different outcomes in the sandbox environment. Each endpoint has a dedicated function in the payment flow, and together they cover the complete process from request creation to refund or cancellation.

***

### Summary of Endpoints

| Endpoint                   | Method   | Description                                                                       |
| -------------------------- | -------- | --------------------------------------------------------------------------------- |
| `/v2/rtp`                  | **POST** | Create a new RTP addressed to a customer alias (phone number).                    |
| `/v2/rtp/{id}`             | **GET**  | Retrieve the current status and details of a specific RTP request.                |
| `/v2/rtp/{id}/cancel`      | **POST** | Cancel an RTP that is still in *Pending* state.                                   |
| `/v2/rtp`                  | **GET**  | List RTP requests created by the merchant, with filtering and pagination options. |
| `/v2/rtp/{id}/refund`      | **POST** | Initiate a refund for an accepted RTP payment.                                    |
| `/v2/rtp/{id}/test-accept` | **POST** | Simulate acceptance of an RTP in the sandbox environment.                         |
| `/v2/rtp/{id}/test-reject` | **POST** | Simulate rejection of an RTP in the sandbox environment.                          |

***

### Narrative overview of Endpoints

#### **Create RTP**

`POST /v2/rtp`\
Creates a new Request to Pay addressed to a specific customer alias (phone number). The request includes amount, currency, expiration, and optional merchant references.

***

#### **Get RTP Status**

`GET /v2/rtp/{id}`\
Retrieves the current status and details of a specific RTP request, such as amount, description, expiration, and timestamps of status changes.

***

#### **Cancel RTP**

`POST /v2/rtp/{id}/cancel`\
Cancels an RTP that is still in **Pending** state. Once cancelled, the request cannot be paid.

***

#### **Get RTP List**

`GET /v2/rtp`\
Returns a paginated list of RTP requests created by the merchant, with filtering options by status, amount, dates, or references. Useful for reconciliation and operational visibility.

***

#### **Refund RTP**

`POST /v2/rtp/{id}/refund`\
Initiates a refund for an RTP payment that has already been accepted and executed. Requires a refund reason to be provided.

***

#### **Simulate Accept (Sandbox only)**

`POST /v2/rtp/{id}/test-accept`\
Simulates the acceptance of an RTP request in the sandbox environment. This triggers a callback and allows developers to test the complete flow without real payments.

***

#### **Simulate Reject (Sandbox only)**

`POST /v2/rtp/{id}/test-reject`\
Simulates the rejection of an RTP request in the sandbox environment. Useful for testing error handling and rejection logic on the merchant side.

***

> Find detailed documentation for each endpoint in the **API Reference** section, including request/response structures, examples, and error handling guidelines.


---

# 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/request-to-pay/getting-started/endpoints-overview.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.
