{
  "info": {
    "_postman_id": "78c09bd4-cb52-4365-8671-0cacb83f6610",
    "name": "P2P Merchant Matching Flow",
    "description": "Postman collection for the merchant matching flow.\n\nIncluded requests:\n1. Create matching via pay-out with `isMatching=true`.\n2. Create invoice pay-in with `method=c2c_invoice`.\n3. Cancel the created pay-in trade.\n4. Extend the pay-in timer.\n5. Upload a receipt through the merchant-authenticated upload endpoint.\n6. Confirm the uploaded receipt on the public payment page.\n\nBefore running the collection, fill in `baseUrl`, `secureKey`, and `receiptFile` variables.\nRun requests in sequence because later requests depend on variables captured from previous responses.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "50661948",
    "_collection_link": "https://go.postman.co/collection/50661948-78c09bd4-cb52-4365-8671-0cacb83f6610?source=collection_link"
  },
  "item": [
    {
      "name": "01. Create matching via pay-out",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-secure-key",
            "value": "{{secureKey}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "options": {
            "raw": {
              "language": "json"
            }
          },
          "raw": "{\n  \"amount\": 10000,\n  \"merchantTransactionId\": \"{{matchingMerchantTransactionId}}\",\n  \"matchingTransactionId\": \"{{matchingTransactionId}}\",\n  \"isMatching\": true,\n  \"callbackUrl\": \"{{callbackUrl}}\",\n  \"payerInfo\": {\n    \"userAgent\": \"Mozilla/5.0 (Linux; Android 14)\",\n    \"ip\": \"203.0.113.45\",\n    \"userId\": \"payer-1001\",\n    \"fingerprint\": \"fingerprint-1001\",\n    \"registeredAt\": 1767908042023\n  },\n  \"requisite\": {\n    \"sbpNumber\": \"79991234567\",\n    \"ownerName\": \"Ivan Ivanov\",\n    \"bank\": \"SBER\"\n  }\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/payment/pay-out",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "payment",
            "pay-out"
          ]
        },
        "description": "Creates a matching request through the standard pay-out endpoint using `isMatching=true`."
      },
      "response": [],
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Response status is success', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
              "const data = pm.response.json();",
              "if (data && data.id) pm.collectionVariables.set('matchingId', data.id);"
            ],
            "packages": {},
            "requests": {}
          }
        }
      ]
    },
    {
      "name": "02. Create pay-in trade (c2c_invoice)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-secure-key",
            "value": "{{secureKey}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "options": {
            "raw": {
              "language": "json"
            }
          },
          "raw": "{\n  \"amount\": 5000,\n  \"currency\": \"rub\",\n  \"method\": \"c2c_invoice\",\n  \"merchantTransactionId\": \"{{payInMerchantTransactionId}}\",\n  \"callbackUrl\": \"{{callbackUrl}}\",\n  \"payerInfo\": {\n    \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X)\",\n    \"ip\": \"203.0.113.46\",\n    \"userId\": \"payer-2002\",\n    \"fingerprint\": \"fingerprint-2002\",\n    \"registeredAt\": 1767908042023\n  }\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/payment/pay-in",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "payment",
            "pay-in"
          ]
        },
        "description": "Creates an invoice pay-in request. Backend will try to attach it to a matching automatically."
      },
      "response": [],
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Response status is success', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
              "const data = pm.response.json();",
              "if (data && data.id) { pm.collectionVariables.set('payInTradeId', data.id); pm.collectionVariables.set('publicTradeId', data.id); }",
              "if (data && data.paymentPageUrl) pm.collectionVariables.set('paymentPageUrl', data.paymentPageUrl);"
            ],
            "packages": {},
            "requests": {}
          }
        }
      ]
    },
    {
      "name": "03. Cancel pay-in trade",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-secure-key",
            "value": "{{secureKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/payment/pay-in/{{payInTradeId}}/cancel",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "payment",
            "pay-in",
            "{{payInTradeId}}",
            "cancel"
          ]
        },
        "description": "Cancels the previously created pay-in trade."
      },
      "response": []
    },
    {
      "name": "04. Extend pay-in timer",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-secure-key",
            "value": "{{secureKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/payment/pay-in/{{payInTradeId}}/extend-timer",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "payment",
            "pay-in",
            "{{payInTradeId}}",
            "extend-timer"
          ]
        },
        "description": "Extends the timer for the previously created pay-in trade."
      },
      "response": []
    },
    {
      "name": "05. Upload receipt (merchant-auth endpoint)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "x-secure-key",
            "value": "{{secureKey}}",
            "type": "text"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "file",
              "type": "file",
              "src": "{{receiptFile}}"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/file/pay-in/invoice/upload?id={{payInTradeId}}",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "file",
            "pay-in",
            "invoice",
            "upload"
          ],
          "query": [
            {
              "key": "id",
              "value": "{{payInTradeId}}"
            }
          ]
        },
        "description": "Uploads a receipt file using the merchant-authenticated invoice upload endpoint."
      },
      "response": [],
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test('Response status is success', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
              "const data = pm.response.json();",
              "if (data && data.uploadMetaKey) pm.collectionVariables.set('uploadMetaKey', data.uploadMetaKey);"
            ],
            "packages": {},
            "requests": {}
          }
        }
      ]
    },
    {
      "name": "06. Confirm uploaded receipt on payment page",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "options": {
            "raw": {
              "language": "json"
            }
          },
          "raw": "{\n  \"uploadMetaKey\": \"{{uploadMetaKey}}\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/payment/public/{{publicTradeId}}/confirm",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "payment",
            "public",
            "{{publicTradeId}}",
            "confirm"
          ]
        },
        "description": "Confirms the uploaded receipt on the public payment page endpoint."
      },
      "response": []
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://backend.ohlapay.io",
      "type": "string"
    },
    {
      "key": "secureKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "callbackUrl",
      "value": "https://merchant.example.com/callback",
      "type": "string"
    },
    {
      "key": "matchingMerchantTransactionId",
      "value": "matching-20260401-001",
      "type": "string"
    },
    {
      "key": "matchingTransactionId",
      "value": "matching-flow-20260401-001",
      "type": "string"
    },
    {
      "key": "payInMerchantTransactionId",
      "value": "payin-20260401-001",
      "type": "string"
    },
    {
      "key": "receiptFile",
      "value": "/absolute/path/to/receipt.pdf",
      "type": "string"
    },
    {
      "key": "matchingId",
      "value": "",
      "type": "string"
    },
    {
      "key": "payInTradeId",
      "value": "",
      "type": "string"
    },
    {
      "key": "publicTradeId",
      "value": "",
      "type": "string"
    },
    {
      "key": "paymentPageUrl",
      "value": "",
      "type": "string"
    },
    {
      "key": "uploadMetaKey",
      "value": "",
      "type": "string"
    }
  ]
}
