{
  "info": {
    "name": "SabPaisa PG 2.0 API",
    "description": "Complete Postman collection for SabPaisa Payment Gateway 2.0 API endpoints",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://merchant-api.sabpaisa.in" },
    { "key": "apiKey", "value": "YOUR_API_KEY" },
    { "key": "merchantId", "value": "YOUR_MERCHANT_ID" }
  ],
  "item": [
    {
      "name": "Payments",
      "item": [
        {
          "name": "Create Payment Session",
          "request": {
            "method": "POST",
            "header": [
              { "key": "X-Api-Key", "value": "{{apiKey}}" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Idempotency-Key", "value": "pay_{{$randomUUID}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"merchantId\": \"{{merchantId}}\",\n  \"merchantTxnId\": \"ORDER_{{$timestamp}}_001\",\n  \"amount\": 50000,\n  \"currency\": \"INR\",\n  \"customerName\": \"Bhargav\",\n  \"customerEmail\": \"bhargav@example.com\",\n  \"customerPhone\": \"9876543210\",\n  \"returnUrl\": \"https://yoursite.com/payment/return\",\n  \"checksum\": \"your_generated_checksum\",\n  \"timestamp\": {{$timestamp}}\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v2/payments", "host": ["{{baseUrl}}"], "path": ["api", "v2", "payments"] }
          }
        },
        {
          "name": "Transaction Enquiry",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-Api-Key", "value": "{{apiKey}}" }],
            "url": {
              "raw": "{{baseUrl}}/api/v2/payments?merchantId={{merchantId}}&merchantTxnId=ORDER_001",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v2", "payments"],
              "query": [
                { "key": "merchantId", "value": "{{merchantId}}" },
                { "key": "merchantTxnId", "value": "ORDER_001" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Refunds",
      "item": [
        {
          "name": "Create Refund",
          "request": {
            "method": "POST",
            "header": [
              { "key": "X-Api-Key", "value": "{{apiKey}}" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Idempotency-Key", "value": "ref_{{$randomUUID}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"merchantId\": \"{{merchantId}}\",\n  \"sabpaisaTxnId\": \"SP_TXN_ID\",\n  \"refundAmount\": 50000,\n  \"reason\": \"Customer requested refund\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v2/refunds", "host": ["{{baseUrl}}"], "path": ["api", "v2", "refunds"] }
          }
        },
        {
          "name": "Get Refund Status",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-Api-Key", "value": "{{apiKey}}" }],
            "url": { "raw": "{{baseUrl}}/api/v2/refunds/REF_ID", "host": ["{{baseUrl}}"], "path": ["api", "v2", "refunds", "REF_ID"] }
          }
        },
        {
          "name": "List Refunds",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-Api-Key", "value": "{{apiKey}}" }],
            "url": {
              "raw": "{{baseUrl}}/api/v2/refunds?merchantId={{merchantId}}&sabpaisaTxnId=SP_TXN_ID",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v2", "refunds"],
              "query": [
                { "key": "merchantId", "value": "{{merchantId}}" },
                { "key": "sabpaisaTxnId", "value": "SP_TXN_ID" }
              ]
            }
          }
        }
      ]
    }
  ]
}
