{
  "info": {
    "name": "Arzan Pay Kaspi Pay API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://pay.arzan.cloud/api" },
    { "key": "apiKey", "value": "YOUR_API_KEY" },
    { "key": "invoiceId", "value": "inv_..." },
    { "key": "webhookId", "value": "wh_..." }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-Key", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "item": [
    {
      "name": "Verify organization",
      "request": { "method": "POST", "url": "{{baseUrl}}/organizations/verify" }
    },
    {
      "name": "Create sandbox invoice",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{baseUrl}}/v1/invoices",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": 10000,\n  \"phone_number\": \"77011234567\",\n  \"description\": \"Sandbox order #1042\",\n  \"external_order_id\": \"order_1042\",\n  \"is_sandbox\": true\n}"
        }
      }
    },
    {
      "name": "Create live invoice",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{baseUrl}}/v1/invoices",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": 10000,\n  \"phone_number\": \"77011234567\",\n  \"description\": \"Live order #1042\",\n  \"external_order_id\": \"live_order_1042\"\n}"
        }
      }
    },
    {
      "name": "List invoices",
      "request": { "method": "GET", "url": "{{baseUrl}}/v1/invoices?page=1&page_size=20" }
    },
    {
      "name": "Get invoice",
      "request": { "method": "GET", "url": "{{baseUrl}}/v1/invoices/{{invoiceId}}" }
    },
    {
      "name": "Cancel invoice",
      "request": { "method": "POST", "url": "{{baseUrl}}/v1/invoices/{{invoiceId}}/cancel" }
    },
    {
      "name": "Create refund",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{baseUrl}}/v1/invoices/{{invoiceId}}/refund",
        "body": { "mode": "raw", "raw": "{\n  \"amount\": 1000,\n  \"reason\": \"Customer request\"\n}" }
      }
    },
    {
      "name": "Create webhook",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{baseUrl}}/v1/webhooks",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"url\": \"https://example.kz/webhooks/kaspi\",\n  \"events\": [\"invoice.status_changed\", \"invoice.refunded\"]\n}"
        }
      }
    },
    {
      "name": "Test webhook",
      "request": { "method": "POST", "url": "{{baseUrl}}/v1/webhooks/{{webhookId}}/test" }
    },
    {
      "name": "Create subscription",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{baseUrl}}/v1/subscriptions",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"phone_number\": \"77011234567\",\n  \"amount\": 10000,\n  \"billing_period\": \"monthly\",\n  \"description\": \"Monthly fee\",\n  \"is_sandbox\": true\n}"
        }
      }
    }
  ]
}
