{
  "info": {
    "name": "QashX Payments API",
    "description": "Provider-agnostic payments API. Generated to mirror the OpenAPI 3.1 spec at /api-v1-payments/openapi.json. Set the {{apiKey}} environment variable to a sandbox key (sk_test_...) before running.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "qashx-payments-v1"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://ecmxmvrimionqhpbjguc.supabase.co/functions/v1/api-v1-payments" }
  ],
  "item": [
    {
      "name": "Payments",
      "item": [
        {
          "name": "Create payment",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{$guid}}" }
            ],
            "url": { "raw": "{{baseUrl}}/v1/payments", "host": ["{{baseUrl}}"], "path": ["v1", "payments"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 1500,\n  \"currency\": \"EUR\",\n  \"capability\": \"card_payment\",\n  \"customer\": { \"email\": \"buyer@example.com\" },\n  \"metadata\": { \"outcome\": \"succeeded\" }\n}"
            }
          }
        },
        {
          "name": "Retrieve payment",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/v1/payments/{{paymentId}}", "host": ["{{baseUrl}}"], "path": ["v1", "payments", "{{paymentId}}"] }
          }
        },
        {
          "name": "List payments",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/v1/payments?limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "payments"],
              "query": [{ "key": "limit", "value": "20" }]
            }
          }
        },
        {
          "name": "Refund payment",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{$guid}}" }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/payments/{{paymentId}}/refund",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "payments", "{{paymentId}}", "refund"]
            },
            "body": { "mode": "raw", "raw": "{ \"amount\": 500, \"reason\": \"customer_request\" }" }
          }
        },
        {
          "name": "Cancel payment",
          "request": {
            "method": "POST",
            "url": {
              "raw": "{{baseUrl}}/v1/payments/{{paymentId}}/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "payments", "{{paymentId}}", "cancel"]
            }
          }
        }
      ]
    },
    {
      "name": "Sandbox",
      "item": [
        {
          "name": "Advance lifecycle",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/v1/sandbox/{{paymentId}}/advance",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "sandbox", "{{paymentId}}", "advance"]
            },
            "body": { "mode": "raw", "raw": "{ \"to\": \"succeeded\" }" }
          }
        },
        {
          "name": "Trigger webhook",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/v1/sandbox/webhooks/trigger",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "sandbox", "webhooks", "trigger"]
            },
            "body": { "mode": "raw", "raw": "{ \"event\": \"payment.succeeded\", \"payment_id\": \"{{paymentId}}\" }" }
          }
        }
      ]
    },
    {
      "name": "OAuth",
      "item": [
        {
          "name": "Client credentials token",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "auth": { "type": "noauth" },
            "url": {
              "raw": "https://ecmxmvrimionqhpbjguc.supabase.co/functions/v1/api-v1-oauth-token",
              "host": ["ecmxmvrimionqhpbjguc.supabase.co"],
              "path": ["functions", "v1", "api-v1-oauth-token"]
            },
            "body": {
              "mode": "raw",
              "raw": "{ \"grant_type\": \"client_credentials\", \"client_id\": \"{{clientId}}\", \"client_secret\": \"{{clientSecret}}\", \"scope\": \"payments.read payments.write\" }"
            }
          }
        }
      ]
    }
  ]
}
