{
  "info": {
    "name": "Nanswap Pay API",
    "description": "REST API for Nanswap Pay. Set the SECRET_API_KEY variable before use.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "BASE_URL",
      "value": "https://api.nanswap.com/pay",
      "type": "string"
    },
    {
      "key": "SECRET_API_KEY",
      "value": "YOUR_SECRET_API_KEY",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Create order",
      "request": {
        "method": "POST",
        "url": "{{BASE_URL}}/order",
        "header": [
          { "key": "Content-Type", "value": "application/json" },
          { "key": "x-nanswap-pay-key", "value": "{{SECRET_API_KEY}}" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"priceAmount\": 10,\n  \"priceCurrency\": \"USD\",\n  \"payinCurrency\": \"XNO\",\n  \"invoiceId\": \"order_123\",\n  \"callbackUrl\": \"https://example.com/webhooks/nanswap\",\n  \"successUrl\": \"https://example.com/thank-you\",\n  \"cancelUrl\": \"https://example.com/cart\"\n}",
          "options": { "raw": { "language": "json" } }
        },
        "description": "Create a new payment invoice. Returns a deposit address the customer should send funds to."
      }
    },
    {
      "name": "Get order",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{BASE_URL}}/order?id=INVOICE_ID",
          "host": ["{{BASE_URL}}"],
          "path": ["order"],
          "query": [{ "key": "id", "value": "INVOICE_ID", "description": "invoiceId returned when the order was created" }]
        },
        "description": "Get the current status of an invoice. No authentication required."
      }
    },
    {
      "name": "Get order estimate",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{BASE_URL}}/order-estimate?payinCurrency=XNO&priceAmount=10&priceCurrency=USD",
          "host": ["{{BASE_URL}}"],
          "path": ["order-estimate"],
          "query": [
            { "key": "payinCurrency", "value": "XNO", "description": "Currency the customer pays in" },
            { "key": "priceAmount", "value": "10", "description": "Amount to charge" },
            { "key": "priceCurrency", "value": "USD", "description": "Currency of the price" },
            { "key": "payoutCurrency", "value": "", "description": "Override payout currency (optional)", "disabled": true }
          ]
        },
        "header": [
          { "key": "x-nanswap-pay-key", "value": "{{SECRET_API_KEY}}" }
        ],
        "description": "Get an estimated amount the customer needs to pay before creating an invoice."
      }
    },
    {
      "name": "List invoices",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{BASE_URL}}/invoices?page=1",
          "host": ["{{BASE_URL}}"],
          "path": ["invoices"],
          "query": [{ "key": "page", "value": "1", "description": "Page number (20 per page)" }]
        },
        "header": [
          { "key": "x-nanswap-pay-key", "value": "{{SECRET_API_KEY}}" }
        ],
        "description": "List all invoices for your merchant account, sorted by most recent."
      }
    },
    {
      "name": "Get payin currencies",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/payin-currencies",
        "description": "Returns all currencies available for the customer to pay in. No authentication required."
      }
    },
    {
      "name": "Get fiat currencies",
      "request": {
        "method": "GET",
        "url": "{{BASE_URL}}/fiat-currencies",
        "description": "Returns all currencies available as priceCurrency (fiat + XNO). No authentication required."
      }
    }
  ]
}
