{
  "info": {
    "name": "UPI PSP Mercury - Complete API Collection",
    "description": "Complete Postman collection for Mercury UPI PSP APIs including NPCI interface and Partner APIs.\n\n## 🔐 Authentication Setup\n\nPartner APIs require API Key authentication. Follow these steps:\n\n1. **Generate API Keys**: Run `mix run priv/scripts/generate_api_keys.exs` in your terminal\n2. **Update Variables**: Set the following collection variables:\n   - `partner_api_key`: Your API key from step 1\n   - `partner_api_secret`: Your API secret from step 1\n   - `partner_id`: Your partner ID (usually 1, 2, 3, etc.)\n\n## 📋 API Groups\n\n- **🏛️ NPCI → PSP Interface**: Official UPI protocol APIs (no auth required)\n- **🤝 Partner → PSP Interface**: QR generation APIs (requires API key auth)\n- **🏪 Partner Merchant Management**: Complete merchant management (requires API key auth)\n- **🔍 International UPI Queries**: FX rates and international QR (no auth required)\n\n## 🚀 Quick Start\n\n1. Set `base_url` to your server URL (default: http://localhost:4000)\n2. Generate API keys using the provided script\n3. Update `partner_api_key` and `partner_api_secret` variables\n4. Test with the 'List Merchants' endpoint first\n\n## 📖 Documentation\n\nFor complete API documentation, visit: http://localhost:4000/api-docs",
    "version": "1.0.0",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost:4000",
      "type": "string"
    },
    {
      "key": "api_version",
      "value": "v1",
      "type": "string"
    },
    {
      "key": "partner_id",
      "value": "1",
      "type": "string",
      "description": "Partner ID (use actual partner ID from database)"
    },
    {
      "key": "merchant_id",
      "value": "MERCHANT_SG_456",
      "type": "string"
    },
    {
      "key": "partner_api_key",
      "value": "your_api_key_here",
      "type": "string",
      "description": "Partner API Key - Replace with actual API key from generate_api_keys.exs output"
    },
    {
      "key": "partner_api_secret",
      "value": "your_api_secret_here",
      "type": "string",
      "description": "Partner API Secret - Replace with actual API secret from generate_api_keys.exs output"
    },
    {
      "key": "partner_token",
      "value": "your_partner_token_here",
      "type": "string",
      "description": "Legacy token - use partner_api_key and partner_api_secret instead"
    }
  ],
  "item": [
    {
      "name": "🏛️ NPCI → PSP Interface (Official UPI APIs)",
      "description": "Official NPCI UPI protocol APIs - These handle communication from NPCI to PSP",
      "item": [
        {
          "name": "1. QR Validation (ReqValQR)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqValQr xmlns=\"urn:txn:npci:uat\">\n  <Head msgId=\"MSG123456789\" orgId=\"TESTORG\" ts=\"2024-03-15T10:30:00\" ver=\"2.0\"/>\n  <Txn custRef=\"REF123456789\" id=\"TXN123456789\" refId=\"RIDT123456789\" refUrl=\"https://test.example.com\" ts=\"2024-03-15T10:30:00\" type=\"QrValidation\"/>\n  <Institution QrPayLoad=\"upi://pay?pa=merchant@bank&amp;am=100.00&amp;cu=INR\"/>\n</ReqValQr>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/validate-qr",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "validate-qr"]
            },
            "description": "NPCI sends QR validation request to PSP for merchant verification and amount validation. Uses simplified XML structure with minimal required fields: Head (msgId, orgId, ts, ver), Txn (custRef, id, refId, refUrl, ts, type), and Institution (QrPayLoad with actual UPI payment string)."
          },
          "response": [
            {
              "name": "Success Response - Basic QR",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqValQr xmlns=\"urn:txn:npci:uat\">\n  <Head msgId=\"MSG123456789\" orgId=\"TESTORG\" ts=\"2024-03-15T10:30:00\" ver=\"2.0\"/>\n  <Txn custRef=\"REF123456789\" id=\"TXN123456789\" refId=\"RIDT123456789\" refUrl=\"https://test.example.com\" ts=\"2024-03-15T10:30:00\" type=\"QrValidation\"/>\n  <Institution QrPayLoad=\"upi://pay?pa=merchant@bank&amp;am=100.00&amp;cu=INR\"/>\n</ReqValQr>"
                },
                "url": {
                  "raw": "{{base_url}}/api/{{api_version}}/upi/validate-qr",
                  "host": ["{{base_url}}"],
                  "path": ["api", "{{api_version}}", "upi", "validate-qr"]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<upi:RespValQr xmlns:upi=\"http://npci.org/upi/schema/\">\n  <Head ver=\"2.0\" ts=\"2025-08-12T15:20:17.994670+00:00\" orgId=\"MERCURY001\" msgId=\"MSG53B6BD091D45CA50\"/>\n  <Txn id=\"6\" note=\"QR Validation\" refId=\"RIDT123456789\" refUrl=\"https://mercury.com\" ts=\"2025-08-12T15:20:17.994685+00:00\" type=\"IntlQr\" initiationMode=\"QR\" purpose=\"00\" custRef=\"REF123456789\">\n    <QR qVer=\"2.0\" ts=\"2025-08-12T15:20:17.994689+00:00\" qrMedium=\"04\" expireTs=\"2025-08-12T15:25:17.994693+00:00\" query=\"upi://pay?pa=merchant@bank&am=100.00&cu=INR\" verToken=\"VT8CEC1A272FE00D355410108FFEBB8825\" stan=\"C7BA7C\"/>\n  </Txn>\n  <Resp errCode=\"00\" result=\"SUCCESS\" reqMsgId=\"MSG123456789\"/>\n  <Payee name=\"International Test Merchant\" addr=\"merchant@mercury\" code=\"5411\" seqNum=\"1\" type=\"ENTITY\">\n    <Institution QrPayLoad=\"upi://pay?pa=merchant@bank&am=100.00&cu=INR\" conCode=\"SG\" netInstId=\"MERCURY001\"/>\n    <Merchant>\n      <Identifier subCode=\"01\" mid=\"MERCHANT_001\" sid=\"STORE_SG_001\" tid=\"TERM_SG_001\" merchantType=\"ENTITY\" merchantGenre=\"RETAIL\" onBoardingType=\"AGGREGATOR\" regId=\"REG_SG_001\" pinCode=\"560001\" tier=\"M2\" merchantLoc=\"Singapore\" merchantInstCode=\"MERC\"/>\n      <Name brand=\"Mercury Merchant\" legal=\"International Test Merchant Pte Ltd\" franchise=\"Mercury International\"/>\n      <Ownership type=\"PRIVATE\"/>\n      <Invoice date=\"2025-08-12\" name=\"International Test Merchant\" num=\"INV_SG_001\"/>\n    </Merchant>\n    <Ac addrType=\"ACCOUNT\">\n      <Detail name=\"IFSC\" value=\"MERC0000001\"/>\n      <Detail name=\"ACTYPE\" value=\"CURRENT\"/>\n      <Detail name=\"ACNUM\" value=\"9876543210\"/>\n    </Ac>\n    <Amount value=\"100.00\" curr=\"INR\">\n      <Split name=\"MAIN\" value=\"100.00\"/>\n    </Amount>\n    <FxList>\n      <Fx baseAmount=\"100.00\" baseCurr=\"INR\" active=\"Y\" Fx=\"83.25\" Mkup=\"2.50\" lastModifiedTs=\"2025-08-12T15:20:17.994767+00:00\"/>\n    </FxList>\n  </Payee>\n</upi:RespValQr>"
            },
            {
              "name": "Success Response - Complex QR",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqValQr xmlns=\"urn:txn:npci:uat\">\n  <Head msgId=\"MSG987654321\" orgId=\"NPCI_TEST\" ts=\"2024-03-15T10:30:00\" ver=\"2.0\"/>\n  <Txn custRef=\"REF987654321\" id=\"TXN987654321\" refId=\"RIDT987654321\" refUrl=\"https://npci.test.com\" ts=\"2024-03-15T10:30:00\" type=\"QrValidation\"/>\n  <Institution QrPayLoad=\"upi://pay?pa=testshop@hdfc&amp;pn=TestShop&amp;mc=5411&amp;am=250.50&amp;cu=INR\"/>\n</ReqValQr>"
                },
                "url": {
                  "raw": "{{base_url}}/api/{{api_version}}/upi/validate-qr",
                  "host": ["{{base_url}}"],
                  "path": ["api", "{{api_version}}", "upi", "validate-qr"]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<upi:RespValQr xmlns:upi=\"http://npci.org/upi/schema/\">\n  <Head ver=\"2.0\" ts=\"2025-08-12T15:22:13.438175+00:00\" orgId=\"MERCURY001\" msgId=\"MSGBDFA94981AB28DBC\"/>\n  <Txn id=\"7\" note=\"QR Validation\" refId=\"RIDT987654321\" refUrl=\"https://mercury.com\" ts=\"2025-08-12T15:22:13.438194+00:00\" type=\"IntlQr\" initiationMode=\"QR\" purpose=\"00\" custRef=\"REF987654321\">\n    <QR qVer=\"2.0\" ts=\"2025-08-12T15:22:13.438198+00:00\" qrMedium=\"04\" expireTs=\"2025-08-12T15:27:13.438201+00:00\" query=\"upi://pay?pa=testshop@hdfc&pn=TestShop&mc=5411&am=250.50&cu=INR\" verToken=\"VT7D84F43EC859B1589098AF435B09694F\" stan=\"CFE116\"/>\n  </Txn>\n  <Resp errCode=\"00\" result=\"SUCCESS\" reqMsgId=\"MSG987654321\"/>\n  <Payee name=\"International Test Merchant\" addr=\"merchant@mercury\" code=\"5411\" seqNum=\"1\" type=\"ENTITY\">\n    <Institution QrPayLoad=\"upi://pay?pa=testshop@hdfc&pn=TestShop&mc=5411&am=250.50&cu=INR\" conCode=\"SG\" netInstId=\"MERCURY001\"/>\n    <Merchant>\n      <Identifier subCode=\"01\" mid=\"MERCHANT_001\" sid=\"STORE_SG_001\" tid=\"TERM_SG_001\" merchantType=\"ENTITY\" merchantGenre=\"RETAIL\" onBoardingType=\"AGGREGATOR\" regId=\"REG_SG_001\" pinCode=\"560001\" tier=\"M2\" merchantLoc=\"Singapore\" merchantInstCode=\"MERC\"/>\n      <Name brand=\"Mercury Merchant\" legal=\"International Test Merchant Pte Ltd\" franchise=\"Mercury International\"/>\n      <Ownership type=\"PRIVATE\"/>\n      <Invoice date=\"2025-08-12\" name=\"International Test Merchant\" num=\"INV_SG_001\"/>\n    </Merchant>\n    <Ac addrType=\"ACCOUNT\">\n      <Detail name=\"IFSC\" value=\"MERC0000001\"/>\n      <Detail name=\"ACTYPE\" value=\"CURRENT\"/>\n      <Detail name=\"ACNUM\" value=\"9876543210\"/>\n    </Ac>\n    <Amount value=\"250.50\" curr=\"INR\">\n      <Split name=\"MAIN\" value=\"250.50\"/>\n    </Amount>\n    <FxList>\n      <Fx baseAmount=\"250.50\" baseCurr=\"INR\" active=\"Y\" Fx=\"83.25\" Mkup=\"2.50\" lastModifiedTs=\"2025-08-12T15:22:13.438261+00:00\"/>\n    </FxList>\n  </Payee>\n</upi:RespValQr>"
            }
          ]
        },
        {
          "name": "2. Payment Processing (ReqPay)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqPay>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"PAY123456789012345678901234567890123\"/>\n  <Txn id=\"PAY123456789012345678901234567890123\" note=\"International payment\" refId=\"PAYREF123\" refUrl=\"\" ts=\"2025-01-11T10:30:00+05:30\" type=\"CREDIT\" subType=\"PAY\">\n    <Rules>\n      <Rule name=\"VALIDATION_PENDING\" value=\"false\"/>\n    </Rules>\n  </Txn>\n  <Payer addr=\"user@demo-bank\" name=\"Test User\" seqNum=\"1\" type=\"PERSON\" code=\"0000\"/>\n  <Payees>\n    <Payee addr=\"merchant@mercury\" name=\"Test Merchant\" type=\"ENTITY\" code=\"5411\"/>\n  </Payees>\n  <Amount curr=\"INR\" value=\"8325.00\"/>\n  <Device>\n    <Tag name=\"MOBILE\" value=\"919876543210\"/>\n    <Tag name=\"GEOCODE\" value=\"22.5726,88.3639\"/>\n    <Tag name=\"LOCATION\" value=\"Kolkata\"/>\n    <Tag name=\"TYPE\" value=\"MOB\"/>\n    <Tag name=\"ID\" value=\"550e8400-e29b-41d4-a716-446655440000\"/>\n    <Tag name=\"IP\" value=\"192.168.1.100\"/>\n    <Tag name=\"APP\" value=\"UPI_APP\"/>\n    <Tag name=\"CAPABILITY\" value=\"11000000000000000000000000000000\"/>\n  </Device>\n</ReqPay>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/process-payment",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "process-payment"]
            },
            "description": "NPCI sends payment request (CREDIT) to PSP for processing with international partner"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RespPay>\n  <Head ver=\"1.0\" ts=\"2025-08-11T09:16:39.677005+00:00\" orgId=\"MERCURY001\" msgId=\"MSG40443045F1A96A00\"/>\n  <Resp reqMsgId=\"PAY123456789012345678901234567890123\" result=\"SUCCESS\" errCode=\"00\" approvalNum=\"APR123\"/>\n  <Txn id=\"TXNB336BBCE5E6157AA\" custRef=\"CUST123\" ts=\"2025-08-11T09:16:39.677024+00:00\" type=\"PAY\"/>\n</RespPay>"
            }
          ]
        },
        {
          "name": "2b. International Payment Processing (ReqPay - International)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqPay xmlns=\"http://npci.org/upi/schema/\">\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"INTPAY123456789012345678901234567890\"/>\n  <Txn id=\"INTPAY123456789012345678901234567890\" note=\"International payment to Singapore\" refId=\"INTPAYREF123\" refUrl=\"\" ts=\"2025-01-11T10:30:00+05:30\" type=\"CREDIT\" subType=\"PAY\">\n    <Rules>\n      <Rule name=\"VALIDATION_PENDING\" value=\"false\"/>\n    </Rules>\n  </Txn>\n  <Payer addr=\"user@demo-bank\" name=\"Test User\" seqNum=\"1\" type=\"PERSON\" code=\"0000\"/>\n  <Payees>\n    <Payee addr=\"merchant@mercury\" name=\"International Merchant\" type=\"ENTITY\" code=\"5411\"/>\n  </Payees>\n  <Amount curr=\"INR\" value=\"8325.00\"/>\n  <Device>\n    <Tag name=\"MOBILE\" value=\"919876543210\"/>\n    <Tag name=\"GEOCODE\" value=\"22.5726,88.3639\"/>\n    <Tag name=\"LOCATION\" value=\"Kolkata\"/>\n    <Tag name=\"TYPE\" value=\"MOB\"/>\n    <Tag name=\"ID\" value=\"550e8400-e29b-41d4-a716-446655440000\"/>\n    <Tag name=\"IP\" value=\"192.168.1.100\"/>\n    <Tag name=\"APP\" value=\"UPI_APP\"/>\n    <Tag name=\"CAPABILITY\" value=\"11000000000000000000000000000000\"/>\n  </Device>\n  <InternationalPay>\n    <Destination>\n      <Country code=\"SG\" name=\"Singapore\"/>\n      <Currency code=\"SGD\" conversion_rate=\"83.25\" markup=\"0.02\"/>\n      <Amount value=\"100.50\" currency=\"SGD\"/>\n    </Destination>\n    <Merchant>\n      <Business>\n        <Name>Singapore Test Merchant Pte Ltd</Name>\n        <RegNumber>201234567X</RegNumber>\n        <Category code=\"5411\" description=\"Grocery Stores\"/>\n        <Address>\n          <Street>123 Orchard Road</Street>\n          <City>Singapore</City>\n          <State>Central</State>\n          <PostalCode>238896</PostalCode>\n          <Country>SG</Country>\n        </Address>\n      </Business>\n      <Settlement>\n        <Account number=\"1234567890\" type=\"SAVINGS\"/>\n        <Bank code=\"DBSSSGSG\" name=\"DBS Bank Ltd\"/>\n        <Currency>SGD</Currency>\n      </Settlement>\n    </Merchant>\n    <Risk>\n      <Scores>\n        <SP score=\"75\" threshold=\"80\"/>\n        <NPCI score=\"82\" threshold=\"85\"/>\n      </Scores>\n      <DeviceFingerprint>\n        <OS version=\"14.5\" type=\"iOS\"/>\n        <App version=\"2.1.5\" build=\"315\"/>\n        <Location lat=\"22.5726\" lng=\"88.3639\" accuracy=\"10\"/>\n        <Network type=\"WIFI\" carrier=\"Airtel\"/>\n        <Device model=\"iPhone12\" manufacturer=\"Apple\"/>\n      </DeviceFingerprint>\n    </Risk>\n    <FXSplit>\n      <Breakdown>\n        <Principal amount=\"8241.75\" percentage=\"99.0\"/>\n        <FXMarkup amount=\"83.25\" percentage=\"1.0\"/>\n      </Breakdown>\n      <Rate base=\"83.25\" applied=\"83.25\" timestamp=\"2025-01-11T10:30:00+05:30\"/>\n    </FXSplit>\n    <Remittance>\n      <Purpose code=\"P0801\" description=\"Personal Payment\"/>\n      <Relationship>Friend</Relationship>\n      <SourceOfFunds>Salary</SourceOfFunds>\n    </Remittance>\n  </InternationalPay>\n</ReqPay>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/process-payment",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "process-payment"]
            },
            "description": "NPCI sends international payment request (CREDIT) to PSP for processing with international partner. Includes enhanced international fields: destination country, FX conversion, merchant business details, risk scoring, device fingerprinting, and remittance information."
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RespPay xmlns=\"http://npci.org/upi/schema/\">\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:32:15.677005+05:30\" orgId=\"MERCURY001\" msgId=\"INTRESP12345678901234567890123456789\"/>\n  <Resp reqMsgId=\"INTPAY123456789012345678901234567890\" result=\"SUCCESS\" errCode=\"00\" approvalNum=\"INTAPR123456\"/>\n  <Txn id=\"INTPAY123456789012345678901234567890\" custRef=\"INTCUST123\" ts=\"2025-01-11T10:32:15.677024+05:30\" type=\"PAY\"/>\n  <InternationalResp>\n    <Settlement>\n      <ForeignAmount value=\"100.50\" currency=\"SGD\"/>\n      <ExchangeRate applied=\"83.25\" timestamp=\"2025-01-11T10:30:00+05:30\"/>\n      <PartnerRef number=\"SG-TXN-20250111-001\" bank=\"DBSSSGSG\"/>\n      <Status code=\"CS\" description=\"Credit Successful\"/>\n    </Settlement>\n    <Merchant>\n      <ApprovalNumber>SG-APR-789123</ApprovalNumber>\n      <SettlementRef>SG-SET-456789</SettlementRef>\n      <ProcessedAt>2025-01-11T10:32:15+08:00</ProcessedAt>\n    </Merchant>\n    <Compliance>\n      <RiskScore final=\"78\" status=\"APPROVED\"/>\n      <Regulations>\n        <FEMA cleared=\"true\" ref=\"FEMA-2025-001234\"/>\n        <MAS cleared=\"true\" ref=\"MAS-2025-005678\"/>\n      </Regulations>\n      <AML status=\"CLEARED\" ref=\"AML-20250111-001\"/>\n    </Compliance>\n  </InternationalResp>\n</RespPay>"
            }
          ]
        },
        {
          "name": "3. Transaction Status Check (ReqChkTxn)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqChkTxn>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"CHK123456789012345678901234567890123\"/>\n  <Txn id=\"CHK123456789012345678901234567890123\" orgTxnId=\"PAY123456789012345678901234567890123\" refId=\"CHKREF123\" type=\"ChkTxn\" subType=\"CREDIT\"/>\n</ReqChkTxn>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/check-transaction",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "check-transaction"]
            },
            "description": "NPCI requests transaction status check (timeout scenario)"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RespChkTxn>\n  <Head ver=\"1.0\" ts=\"2025-08-11T09:17:01.762005+00:00\" orgId=\"MERCURY001\" msgId=\"MSG667550ED3BC93046\"/>\n  <Resp reqMsgId=\"CHK123456789012345678901234567890123\" result=\"SUCCESS\" errCode=\"00\"/>\n  <Txn id=\"TXND09E56CCE5EB1B24\" orgTxnId=\"PAY123456789012345678901234567890123\" status=\"SUCCESS\" ts=\"2025-08-11T09:17:01.762051+00:00\"/>\n  <Amount curr=\"INR\" value=\"8325.00\"/>\n</RespChkTxn>"
            }
          ]
        },
        {
          "name": "4. Heartbeat Check (ReqHbt)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReqHbt>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"HBT123456789012345678901234567890123\"/>\n</ReqHbt>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/heartbeat",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "heartbeat"]
            },
            "description": "NPCI health check to verify PSP system availability"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "xml",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/xml"
                }
              ],
              "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RespHbt>\n  <Head ver=\"1.0\" ts=\"2025-08-11T08:23:05.480479+00:00\" orgId=\"MERCURY001\" msgId=\"MSG8A78F04D9ED2577C\"/>\n  <Resp reqMsgId=\"HBT123456789012345678901234567890123\" result=\"SUCCESS\" errCode=\"00\"/>\n</RespHbt>"
            }
          ]
        },
        {
          "name": "5. Batch Transaction Check",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<BatchReq>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"BATCH123456789012345678901234567890\"/>\n  <BatchInfo batchId=\"BATCH001\" totalTxns=\"3\"/>\n  <Transactions>\n    <Txn orgTxnId=\"TXN001\" type=\"PAY\"/>\n    <Txn orgTxnId=\"TXN002\" type=\"COLLECT\"/>\n    <Txn orgTxnId=\"TXN003\" type=\"PAY\"/>\n  </Transactions>\n</BatchReq>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/batch-check",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "batch-check"]
            },
            "description": "Batch processing for multiple transaction status checks"
          }
        },
        {
          "name": "6. Settlement Reconciliation",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ReconciliationReq>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"REC123456789012345678901234567890123\"/>\n  <ReconciliationInfo>\n    <fromDate>2025-01-10</fromDate>\n    <toDate>2025-01-11</toDate>\n    <partnerCode>SINGAPORE_PARTNER</partnerCode>\n  </ReconciliationInfo>\n</ReconciliationReq>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/reconciliation",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "reconciliation"]
            },
            "description": "Settlement reconciliation for international transactions"
          }
        },
        {
          "name": "7. Mandate Management",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/xml"
              },
              {
                "key": "Accept",
                "value": "application/xml"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<MandateReq>\n  <Head ver=\"2.0\" ts=\"2025-01-11T10:30:00+05:30\" orgId=\"NPCI\" msgId=\"MAN123456789012345678901234567890123\"/>\n  <MandateInfo>\n    <mandateId>MANDATE_001</mandateId>\n    <amount>1000.00</amount>\n    <frequency>MONTHLY</frequency>\n    <startDate>2025-02-01</startDate>\n    <endDate>2025-12-31</endDate>\n  </MandateInfo>\n  <Payer addr=\"user@demo-bank\" name=\"Test User\"/>\n  <Payee addr=\"merchant@mercury\" name=\"Test Merchant\"/>\n</MandateReq>"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/mandate-request",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "mandate-request"]
            },
            "description": "Recurring payment mandate management"
          }
        }
      ]
    },
    {
      "name": "🤝 Partner → PSP Interface (Business APIs)",
      "description": "Partner-facing APIs for QR generation and management",
      "item": [
        {
          "name": "1. Generate QR Code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner API Key for authentication"
              },
                            {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"partner_id\": \"SINGAPORE_PARTNER_001\",\n  \"merchant_id\": \"MERCHANT_SG_123\",\n  \"amount\": \"100.50\",\n  \"currency\": \"SGD\",\n  \"corridor\": \"singapore\",\n  \"merchant_name\": \"Singapore Test Merchant\",\n  \"merchant_category\": \"5411\",\n  \"purpose_code\": \"P0101\",\n  \"validity_minutes\": 300,\n  \"max_usage_count\": 1,\n  \"metadata\": {\n    \"invoice_id\": \"INV_2025_001\",\n    \"customer_ref\": \"CUST_REF_123\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/qr-generate",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "qr-generate"]
            },
            "description": "Partner requests QR code generation for their merchant with international parameters"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "POST",
                "header": [],
                "body": {
                  "mode": "raw",
                  "raw": ""
                },
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"qr_id\": \"QR_SG_2025_001\",\n    \"qr_string\": \"upi://pay?pa=merchant@mercury&pn=Singapore%20Test%20Merchant&am=8325.00&cu=INR&mc=5411&pc=P0101\",\n    \"merchant_id\": \"MERCHANT_SG_123\",\n    \"amount\": \"100.50\",\n    \"currency\": \"SGD\",\n    \"fx_rate\": \"83.25\",\n    \"markup_percentage\": \"2.5\",\n    \"inr_amount\": \"8325.00\",\n    \"expires_at\": \"2025-01-11T15:30:00Z\",\n    \"qr_url\": \"https://mercury-psp.com/qr/dXBpOi8vcGF5P3BhPW1lcmNoYW50QG1lcmN1cnkmc\",\n    \"status\": \"active\"\n  },\n  \"message\": \"QR code generated successfully\"\n}"
            }
          ]
        },
        {
          "name": "2. Check QR Status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner API Key for authentication"
              },
                            {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/qr-status/QR_SG_2025_001",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "qr-status", "QR_SG_2025_001"]
            },
            "description": "Partner checks QR code status and usage details"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"qr_id\": \"QR_SG_2025_001\",\n    \"merchant_id\": \"MERCHANT_SG_123\",\n    \"partner_id\": \"SINGAPORE_PARTNER_001\",\n    \"amount\": \"100.50\",\n    \"currency\": \"SGD\",\n    \"fx_rate\": \"83.25\",\n    \"inr_amount\": \"8325.00\",\n    \"status\": \"used\",\n    \"created_at\": \"2025-01-11T10:30:00Z\",\n    \"expires_at\": \"2025-01-11T15:30:00Z\",\n    \"usage_count\": 1,\n    \"max_usage\": 1,\n    \"qr_string\": \"upi://pay?pa=merchant@mercury&pn=Singapore%20Test%20Merchant&am=8325.00&cu=INR&mc=5411&pc=P0101\",\n    \"last_used_at\": \"2025-01-11T12:45:00Z\",\n    \"transactions\": [\n      {\n        \"txn_id\": \"TXN_SG_001\",\n        \"status\": \"success\",\n        \"completed_at\": \"2025-01-11T12:45:30Z\"\n      }\n    ]\n  },\n  \"message\": \"QR status retrieved successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "🏪 Partner Merchant Management APIs",
      "description": "Complete merchant lifecycle management APIs for partners",
      "item": [
        {
          "name": "1. Create Merchant",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner API Key for authentication"
              },
                            {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"merchant_name\": \"Singapore Digital Store\",\n  \"merchant_id\": \"MERCHANT_SG_456\",\n  \"corridor\": \"SINGAPORE\",\n  \"business_category\": \"5411\",\n  \"contact_email\": \"contact@sgstore.com\",\n  \"contact_phone\": \"+6591234567\",\n  \"business_address\": {\n    \"street\": \"456 Marina Bay\",\n    \"city\": \"Singapore\",\n    \"state\": \"Central\",\n    \"pincode\": \"018956\",\n    \"country\": \"SG\"\n  },\n  \"settlement_account\": {\n    \"account_number\": \"1234567890\",\n    \"bank_code\": \"DBSSSGSG\",\n    \"currency\": \"SGD\"\n  },\n  \"limits\": {\n    \"daily_limit\": \"50000.00\",\n    \"monthly_limit\": \"1000000.00\",\n    \"per_transaction_limit\": \"10000.00\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants"]
            },
            "description": "Create a new merchant under a partner"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"merchant_name\": \"Singapore Digital Store\",\n    \"status\": \"ACTIVE\",\n    \"corridor\": \"SINGAPORE\",\n    \"partner_id\": \"SINGAPORE_PARTNER_001\",\n    \"compliance_status\": \"APPROVED\",\n    \"created_at\": \"2025-01-15T10:30:00Z\",\n    \"settlement_account\": {\n      \"account_number\": \"1234567890\",\n      \"bank_code\": \"DBSSSGSG\",\n      \"currency\": \"SGD\"\n    }\n  },\n  \"message\": \"Merchant created successfully\"\n}"
            }
          ]
        },
        {
          "name": "2. List Merchants",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner API Key for authentication"
              },
                            {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants?corridor=SINGAPORE&status=ACTIVE&page=1&limit=20",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants"],
              "query": [
                {
                  "key": "corridor",
                  "value": "SINGAPORE",
                  "description": "Filter by corridor"
                },
                {
                  "key": "status",
                  "value": "ACTIVE",
                  "description": "Filter by status"
                },
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number"
                },
                {
                  "key": "limit",
                  "value": "20",
                  "description": "Results per page"
                }
              ]
            },
            "description": "Get all merchants for a partner with optional filtering"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchants\": [\n      {\n        \"merchant_id\": \"MERCHANT_SG_456\",\n        \"merchant_name\": \"Singapore Digital Store\",\n        \"corridor\": \"SINGAPORE\",\n        \"status\": \"ACTIVE\",\n        \"compliance_status\": \"APPROVED\",\n        \"created_at\": \"2025-01-15T10:30:00Z\"\n      }\n    ],\n    \"pagination\": {\n      \"current_page\": 1,\n      \"per_page\": 20,\n      \"total_pages\": 1,\n      \"total_count\": 1\n    }\n  },\n  \"message\": \"Merchants retrieved successfully\"\n}"
            }
          ]
        },
        {
          "name": "3. Get Merchant Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/{{merchant_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "{{merchant_id}}"]
            },
            "description": "Get detailed information about a specific merchant"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"merchant_name\": \"Singapore Digital Store\",\n    \"corridor\": \"SINGAPORE\",\n    \"status\": \"ACTIVE\",\n    \"compliance_status\": \"APPROVED\",\n    \"business_category\": \"5411\",\n    \"contact_email\": \"contact@sgstore.com\",\n    \"contact_phone\": \"+6591234567\",\n    \"business_address\": {\n      \"street\": \"456 Marina Bay\",\n      \"city\": \"Singapore\",\n      \"state\": \"Central\",\n      \"pincode\": \"018956\",\n      \"country\": \"SG\"\n    },\n    \"settlement_account\": {\n      \"account_number\": \"1234567890\",\n      \"bank_code\": \"DBSSSGSG\",\n      \"currency\": \"SGD\"\n    },\n    \"limits\": {\n      \"daily_limit\": \"50000.00\",\n      \"monthly_limit\": \"1000000.00\",\n      \"per_transaction_limit\": \"10000.00\"\n    },\n    \"created_at\": \"2025-01-15T10:30:00Z\",\n    \"updated_at\": \"2025-01-15T10:30:00Z\"\n  },\n  \"message\": \"Merchant details retrieved successfully\"\n}"
            }
          ]
        },
        {
          "name": "4. Update Merchant",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"merchant_name\": \"Singapore Digital Store Ltd\",\n  \"contact_phone\": \"+6591234568\",\n  \"business_address\": {\n    \"street\": \"456 Marina Bay Sands\",\n    \"city\": \"Singapore\",\n    \"state\": \"Central\",\n    \"pincode\": \"018956\",\n    \"country\": \"SG\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/{{merchant_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "{{merchant_id}}"]
            },
            "description": "Update merchant information"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"merchant_name\": \"Singapore Digital Store Ltd\",\n    \"status\": \"ACTIVE\",\n    \"updated_at\": \"2025-01-15T11:30:00Z\"\n  },\n  \"message\": \"Merchant updated successfully\"\n}"
            }
          ]
        },
        {
          "name": "5. Validate Merchant for Transaction",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": \"500.00\",\n  \"currency\": \"SGD\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/{{merchant_id}}/validate",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "{{merchant_id}}", "validate"]
            },
            "description": "Validate if merchant is ready for transaction processing"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"valid\": true,\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"merchant_name\": \"Singapore Digital Store Ltd\",\n    \"compliance_status\": \"APPROVED\",\n    \"limits_check\": {\n      \"daily_remaining\": \"49500.00\",\n      \"monthly_remaining\": \"999500.00\",\n      \"per_transaction_limit\": \"10000.00\"\n    }\n  },\n  \"message\": \"Merchant validated successfully\"\n}"
            }
          ]
        },
        {
          "name": "6. Check Merchant Limits",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/{{merchant_id}}/limits?date=2025-01-15",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "{{merchant_id}}", "limits"],
              "query": [
                {
                  "key": "date",
                  "value": "2025-01-15",
                  "description": "Date for limit check (YYYY-MM-DD)"
                }
              ]
            },
            "description": "Check current transaction limits and usage for merchant"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"date\": \"2025-01-15\",\n    \"limits\": {\n      \"daily_limit\": \"50000.00\",\n      \"daily_used\": \"500.00\",\n      \"daily_remaining\": \"49500.00\",\n      \"monthly_limit\": \"1000000.00\",\n      \"monthly_used\": \"500.00\",\n      \"monthly_remaining\": \"999500.00\",\n      \"per_transaction_limit\": \"10000.00\"\n    },\n    \"transaction_count\": {\n      \"daily\": 1,\n      \"monthly\": 1\n    }\n  },\n  \"message\": \"Merchant limits retrieved successfully\"\n}"
            }
          ]
        },
        {
          "name": "7. Search Merchants",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/search?q=Singapore&corridor=SINGAPORE&status=ACTIVE&limit=10",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "search"],
              "query": [
                {
                  "key": "q",
                  "value": "Singapore",
                  "description": "Search query"
                },
                {
                  "key": "corridor",
                  "value": "SINGAPORE",
                  "description": "Filter by corridor"
                },
                {
                  "key": "status",
                  "value": "ACTIVE",
                  "description": "Filter by status"
                },
                {
                  "key": "limit",
                  "value": "10",
                  "description": "Results limit"
                }
              ]
            },
            "description": "Search merchants by various criteria"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"results\": [\n      {\n        \"merchant_id\": \"MERCHANT_SG_456\",\n        \"merchant_name\": \"Singapore Digital Store Ltd\",\n        \"corridor\": \"SINGAPORE\",\n        \"status\": \"ACTIVE\",\n        \"contact_email\": \"contact@sgstore.com\",\n        \"match_score\": 0.95\n      }\n    ],\n    \"total_results\": 1,\n    \"search_time_ms\": 45\n  },\n  \"message\": \"Search completed successfully\"\n}"
            }
          ]
        },
        {
          "name": "8. Get Merchant Statistics",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-API-Key",
                "value": "{{partner_api_key}}",
                "description": "Partner authentication token"
              },
              {
                "key": "X-API-Secret",
                "value": "{{partner_api_secret}}",
                "description": "Partner API Secret for additional security"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/partners/{{partner_id}}/merchants/{{merchant_id}}/stats?period=month&start_date=2025-01-01&end_date=2025-01-31",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "partners", "{{partner_id}}", "merchants", "{{merchant_id}}", "stats"],
              "query": [
                {
                  "key": "period",
                  "value": "month",
                  "description": "Time period"
                },
                {
                  "key": "start_date",
                  "value": "2025-01-01",
                  "description": "Start date (YYYY-MM-DD)"
                },
                {
                  "key": "end_date",
                  "value": "2025-01-31",
                  "description": "End date (YYYY-MM-DD)"
                }
              ]
            },
            "description": "Get comprehensive statistics for a merchant"
          },
          "response": [
            {
              "name": "Success Response",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"merchant_id\": \"MERCHANT_SG_456\",\n    \"period\": \"month\",\n    \"date_range\": {\n      \"start\": \"2025-01-01\",\n      \"end\": \"2025-01-31\"\n    },\n    \"transaction_stats\": {\n      \"total_transactions\": 150,\n      \"successful_transactions\": 148,\n      \"failed_transactions\": 2,\n      \"success_rate\": \"98.67%\",\n      \"total_volume\": \"75000.00\",\n      \"average_transaction\": \"500.00\",\n      \"currency\": \"SGD\"\n    },\n    \"daily_breakdown\": [\n      {\n        \"date\": \"2025-01-15\",\n        \"transactions\": 5,\n        \"volume\": \"2500.00\"\n      },\n      {\n        \"date\": \"2025-01-16\",\n        \"transactions\": 8,\n        \"volume\": \"4000.00\"\n      }\n    ],\n    \"compliance\": {\n      \"status\": \"APPROVED\",\n      \"last_review\": \"2025-01-01T00:00:00Z\",\n      \"next_review\": \"2025-04-01T00:00:00Z\"\n    }\n  },\n  \"message\": \"Merchant statistics retrieved successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "🔍 International UPI Queries",
      "description": "PSP internal APIs for international transaction support",
      "item": [
        {
          "name": "1. Get International QR",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/international-qr?merchant_id=MERCHANT_SG_123&amount=100.50&currency=SGD&corridor=singapore",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "international-qr"],
              "query": [
                {
                  "key": "merchant_id",
                  "value": "MERCHANT_SG_123"
                },
                {
                  "key": "amount",
                  "value": "100.50"
                },
                {
                  "key": "currency",
                  "value": "SGD"
                },
                {
                  "key": "corridor",
                  "value": "singapore"
                }
              ]
            },
            "description": "Get international QR with FX conversion details"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"qr_string\": \"upi://pay?pa=merchant@mercury&pn=Singapore%20Test%20Merchant&am=8325.00&cu=INR&mc=5411\",\n    \"foreign_amount\": \"100.50\",\n    \"foreign_currency\": \"SGD\",\n    \"fx_rate\": \"83.25\",\n    \"markup_percentage\": \"2.5\",\n    \"inr_amount\": \"8325.00\",\n    \"corridor\": \"singapore\",\n    \"validity_minutes\": 300\n  },\n  \"message\": \"International QR generated successfully\"\n}"
            }
          ]
        },
        {
          "name": "2. Get FX Rate",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/upi/fx-rate/SGD/INR",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "upi", "fx-rate", "SGD", "INR"]
            },
            "description": "Get current FX rate for currency conversion"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"from_currency\": \"SGD\",\n    \"to_currency\": \"INR\",\n    \"base_rate\": \"81.25\",\n    \"markup_percentage\": \"2.5\",\n    \"final_rate\": \"83.25\",\n    \"rate_timestamp\": \"2025-01-11T10:30:00Z\",\n    \"rate_source\": \"LIVE_MARKET\"\n  },\n  \"message\": \"FX rate retrieved successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "📊 Legacy Transaction APIs",
      "description": "Legacy transaction management APIs (if needed for backward compatibility)",
      "item": [
        {
          "name": "1. List Transactions",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/transactions?status=success&limit=10&offset=0",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "transactions"],
              "query": [
                {
                  "key": "status",
                  "value": "success"
                },
                {
                  "key": "limit",
                  "value": "10"
                },
                {
                  "key": "offset",
                  "value": "0"
                }
              ]
            },
            "description": "List transactions with filtering options"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"transactions\": [\n      {\n        \"id\": 1,\n        \"org_txn_id\": \"TXN_SG_001\",\n        \"payer_addr\": \"user@demo-bank\",\n        \"payee_addr\": \"merchant@mercury\",\n        \"foreign_amount\": \"100.50\",\n        \"foreign_currency\": \"SGD\",\n        \"fx_rate\": \"83.25\",\n        \"inr_amount\": \"8325.00\",\n        \"status\": \"success\",\n        \"corridor\": \"singapore\",\n        \"created_at\": \"2025-01-11T10:30:00Z\",\n        \"completed_at\": \"2025-01-11T10:32:15Z\"\n      }\n    ],\n    \"pagination\": {\n      \"total\": 1,\n      \"limit\": 10,\n      \"offset\": 0,\n      \"has_more\": false\n    }\n  },\n  \"message\": \"Transactions retrieved successfully\"\n}"
            }
          ]
        },
        {
          "name": "2. Get Transaction Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/{{api_version}}/transactions/TXN_SG_001",
              "host": ["{{base_url}}"],
              "path": ["api", "{{api_version}}", "transactions", "TXN_SG_001"]
            },
            "description": "Get detailed transaction information with event history"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "body": "{\n  \"success\": true,\n  \"data\": {\n    \"transaction\": {\n      \"id\": 1,\n      \"org_txn_id\": \"TXN_SG_001\",\n      \"payer_addr\": \"user@demo-bank\",\n      \"payee_addr\": \"merchant@mercury\",\n      \"foreign_amount\": \"100.50\",\n      \"foreign_currency\": \"SGD\",\n      \"fx_rate\": \"83.25\",\n      \"inr_amount\": \"8325.00\",\n      \"status\": \"success\",\n      \"corridor\": \"singapore\",\n      \"partner_code\": \"SINGAPORE_PARTNER_001\",\n      \"created_at\": \"2025-01-11T10:30:00Z\",\n      \"completed_at\": \"2025-01-11T10:32:15Z\"\n    },\n    \"events\": [\n      {\n        \"seq\": 1,\n        \"event_type\": \"transaction_initiated\",\n        \"timestamp\": \"2025-01-11T10:30:00Z\",\n        \"payload\": {\n          \"initiated_by\": \"NPCI\",\n          \"amount\": \"8325.00\"\n        }\n      },\n      {\n        \"seq\": 2,\n        \"event_type\": \"partner_credit_requested\",\n        \"timestamp\": \"2025-01-11T10:30:30Z\",\n        \"payload\": {\n          \"partner\": \"SINGAPORE_PARTNER_001\",\n          \"foreign_amount\": \"100.50\",\n          \"currency\": \"SGD\"\n        }\n      },\n      {\n        \"seq\": 3,\n        \"event_type\": \"transaction_completed\",\n        \"timestamp\": \"2025-01-11T10:32:15Z\",\n        \"payload\": {\n          \"final_status\": \"success\",\n          \"partner_response\": \"CS\"\n        }\n      }\n    ]\n  },\n  \"message\": \"Transaction details retrieved successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "🧪 Test & Development",
      "description": "Testing and development utilities",
      "item": [
        {
          "name": "Health Check",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/",
              "host": ["{{base_url}}"],
              "path": [""]
            },
            "description": "Basic health check endpoint"
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "",
                  "host": [""]
                }
              },
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "html",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "text/html"
                }
              ],
              "body": "<!DOCTYPE html>\n<html>\n<head>\n    <title>Mercury UPI PSP</title>\n</head>\n<body>\n    <h1>Mercury UPI PSP - System Online</h1>\n    <p>UPI Payment Service Provider - Ready for NPCI integration</p>\n</body>\n</html>"
            }
          ]
        }
      ]
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{partner_token}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Auto-generate timestamps for requests",
          "const now = new Date();",
          "const timestamp = now.toISOString();",
          "pm.globals.set('timestamp', timestamp);",
          "",
          "// Generate random message IDs for UPI requests",
          "const messageId = 'MSG' + Math.random().toString(36).substr(2, 32).toUpperCase();",
          "pm.globals.set('message_id', messageId);",
          "",
          "// Generate random transaction IDs",
          "const txnId = 'TXN' + Math.random().toString(36).substr(2, 32).toUpperCase();",
          "pm.globals.set('txn_id', txnId);"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Basic response validation",
          "pm.test('Response status is successful', function () {",
          "    pm.expect(pm.response.code).to.be.oneOf([200, 201]);",
          "});",
          "",
          "// Content-Type validation",
          "pm.test('Response has correct content type', function () {",
          "    const contentType = pm.response.headers.get('Content-Type');",
          "    pm.expect(contentType).to.satisfy(function(type) {",
          "        return type.includes('application/json') || type.includes('application/xml') || type.includes('text/html');",
          "    });",
          "});",
          "",
          "// Response time validation",
          "pm.test('Response time is reasonable', function () {",
          "    pm.expect(pm.response.responseTime).to.be.below(5000);",
          "});"
        ]
      }
    }
  ]
}
