{
  "info": {
    "name": "LeefiPay API v1",
    "description": "Sanctum-authenticated multi-tenant collect API.\n\n1. POST /auth/token\n2. Set Bearer token\n3. Call resources",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Auth",
      "item": [
        {
          "name": "Issue token",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"owner@demotraders.co.ke\",\n  \"password\": \"password\",\n  \"device_name\": \"postman\",\n  \"abilities\": [\"*\"]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": "{{baseUrl}}/api/v1/auth/token"
          }
        },
        {
          "name": "Me",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Accept", "value": "application/json" }
            ],
            "url": "{{baseUrl}}/api/v1/auth/me"
          }
        }
      ]
    },
    {
      "name": "Payments",
      "item": [
        {
          "name": "STK Push",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Idempotency-Key", "value": "demo-stk-1" },
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 100,\n  \"phone\": \"0712345678\",\n  \"payment_channel_id\": 1\n}"
            },
            "url": "{{baseUrl}}/api/v1/payments/stk"
          }
        },
        {
          "name": "Cash",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 100,\n  \"payment_channel_id\": 1,\n  \"customer_name\": \"Walk-in\"\n}"
            },
            "url": "{{baseUrl}}/api/v1/payments/cash"
          }
        }
      ]
    },
    {
      "name": "WooCommerce",
      "item": [
        {
          "name": "Create order invoice",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_id\": \"1001\",\n  \"site_url\": \"https://shop.example.com\",\n  \"customer\": {\n    \"name\": \"Jane Doe\",\n    \"email\": \"jane@example.com\",\n    \"phone\": \"0712345678\"\n  },\n  \"line_items\": [\n    { \"name\": \"T-Shirt\", \"quantity\": 2, \"unit_price\": 500 }\n  ],\n  \"shipping_total\": 100,\n  \"initiate_stk\": false\n}"
            },
            "url": "{{baseUrl}}/api/v1/integrations/woocommerce/orders"
          }
        },
        {
          "name": "Order status",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Accept", "value": "application/json" }
            ],
            "url": "{{baseUrl}}/api/v1/integrations/woocommerce/orders/1"
          }
        },
        {
          "name": "Initiate STK",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Authorization", "value": "Bearer {{token}}" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"0712345678\",\n  \"payment_channel_id\": 1\n}"
            },
            "url": "{{baseUrl}}/api/v1/integrations/woocommerce/orders/1/stk"
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "M-Pesa callback",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"Body\": {\n    \"stkCallback\": {\n      \"CheckoutRequestID\": \"ws_CO_123\",\n      \"ResultCode\": 0,\n      \"ResultDesc\": \"Success\"\n    }\n  }\n}"
            },
            "url": "{{baseUrl}}/api/v1/webhooks/mpesa"
          }
        },
        {
          "name": "SMS DLR",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"message_id\": \"123\",\n  \"mobile\": \"254712345678\",\n  \"status\": \"Delivered\"\n}"
            },
            "url": "{{baseUrl}}/api/v1/webhooks/sms/delivery"
          }
        }
      ]
    }
  ],
  "variable": [
    { "key": "baseUrl", "value": "http://localhost:8000" },
    { "key": "token", "value": "" }
  ]
}
