# Workflow payment

When using the MartPay payment system, certain limitations apply to accepting payments. The key characteristic is that funds are not credited to the settlement account immediately: during the processing stage, the bank reserves the right to cancel a previously initiated transaction.

Such situations occur infrequently; however, this mechanism is sometimes exploited by fraudsters. They initiate a payment, and the funds temporarily appear in the merchant’s application. The bank then reverses the transaction and returns the money to the payer. During this time, the fraudsters manage to withdraw the funds from the application, resulting in financial losses for the merchant.

### Proposed Process for Mitigating the Limitations

To reduce the risks associated with potential transaction reversals, a staged payment confirmation process is implemented.

***

1. #### **Creation of a Payment Link**

When generating a payment link, an order is not created in our system upon calling the following method:\
POST  `https://api.martpay.net/api/v2/pis/payment`

At this stage, the order does not yet exist in the system and has the status **NOT\_FOUND**.

***

2. #### **Payment Initiation**

After the user is redirected to the payment system, the transaction receives the status <mark style="color:$warning;">**IN\_PROGRESS**</mark>.

***

3. #### **Partial Payment Confirmation**

After receiving a notification from the bank confirming the successful processing of the transaction, the status is updated to <mark style="color:$success;">**ACCEPTED\_SETTLEMENT\_IN\_PROCESS**</mark>. At the same time, a webhook is sent containing information about the transaction status update.

At this stage, funds may be credited to the user’s balance and reflected in the merchant’s application; however, shipping goods and withdrawing funds are not yet permitted.

❗ <mark style="color:$success;">**ACCEPTED\_SETTLEMENT\_IN\_PROCESS**</mark> — the transaction may still transition to **CANCELED**, in which case the funds are returned to the user’s bank account.

***

4. #### **Full Payment Confirmation**

After receiving the final confirmation of a successfully processed transaction, the status changes to **COMPLETED**, and the webhook notification is sent again.

❗️**Important**❗️

{% hint style="danger" %}
If the payment does not receive confirmation within two days from the moment the user enters the payment system, the transaction is automatically changed to the **CANCELED** status.
{% endhint %}


---

# 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.martpay.net/workflow-payment.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.
