{
  "info": {
    "name": "eezi - Norway (EHF / Peppol) - Credit notes",
    "description": "Sample credit note requests for a Norwegian eezi organisation (3 requests). Send 00 first: it creates the invoice the credit notes refer to.\n\n1. Open the collection's Variables tab and set apiToken to your organisation API key.\n2. Send 00, then 01 and 02, and check each response.\n\nEvery ref must be unique: change the refs (and the invoiceRefs in 01 and 02) before sending again. See https://docs.eezi.io/docs/data-models-credit-note-nor",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "00 - Invoice to Credit (send first)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Accepted (2xx)\", function () {",
              "    pm.expect(pm.response.code).to.be.within(200, 299);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Authorization",
            "value": "{{apiToken}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"ref\": \"Test-INV-CN-001\",\n  \"issued\": \"2026-11-18\",\n  \"dueDate\": \"2026-12-18\",\n  \"purchaseOrderRef\": \"PO-0001\",\n  \"customInfo\": {\n    \"nor\": {\n      \"deliveryDate\": \"2026-11-13\"\n    }\n  },\n  \"recipient\": {\n    \"name\": \"Example Buyer AS\",\n    \"taxId\": \"NO123456785MVA\",\n    \"address\": {\n      \"line1\": \"Example Street 1\",\n      \"city\": \"Oslo\",\n      \"postalCode\": \"0150\",\n      \"country\": \"NOR\"\n    },\n    \"peppolId\": {\n      \"endpointId\": \"iso6523-actorid-upis::0192:123456785\"\n    }\n  },\n  \"paymentMeans\": [\n    {\n      \"code\": \"30\",\n      \"ref\": \"1001001005\",\n      \"account\": {\n        \"number\": \"12345678903\"\n      }\n    }\n  ],\n  \"lines\": [\n    {\n      \"description\": \"Office chair\",\n      \"quantity\": 2,\n      \"unit\": \"H87\",\n      \"price\": {\n        \"amount\": 1500.0\n      },\n      \"vat\": {\n        \"type\": \"percent\",\n        \"amount\": 25,\n        \"code\": \"S\"\n      }\n    },\n    {\n      \"description\": \"Coffee\",\n      \"quantity\": 10,\n      \"unit\": \"KGM\",\n      \"price\": {\n        \"amount\": 120.0\n      },\n      \"vat\": {\n        \"type\": \"percent\",\n        \"amount\": 15,\n        \"code\": \"S\"\n      }\n    }\n  ],\n  \"total\": {\n    \"amount\": 5130.0,\n    \"currency\": \"NOK\"\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/v1/invoice",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "invoice"]
        },
        "description": "Creates the invoice that the credit notes in this collection refer to (Test-INV-CN-001). Send it first."
      }
    },
    {
      "name": "01 - Credit Note: Return of One Item",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Accepted (2xx)\", function () {",
              "    pm.expect(pm.response.code).to.be.within(200, 299);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Authorization",
            "value": "{{apiToken}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"ref\": \"Test-CN-001\",\n  \"issued\": \"2026-11-20\",\n  \"dueDate\": \"2026-12-20\",\n  \"invoiceRefs\": [\n    \"Test-INV-CN-001\"\n  ],\n  \"customInfo\": {\n    \"nor\": {\n      \"deliveryDate\": \"2026-11-13\"\n    }\n  },\n  \"recipient\": {\n    \"name\": \"Example Buyer AS\",\n    \"taxId\": \"NO123456785MVA\",\n    \"address\": {\n      \"line1\": \"Example Street 1\",\n      \"city\": \"Oslo\",\n      \"postalCode\": \"0150\",\n      \"country\": \"NOR\"\n    },\n    \"peppolId\": {\n      \"endpointId\": \"iso6523-actorid-upis::0192:123456785\"\n    }\n  },\n  \"lines\": [\n    {\n      \"description\": \"Office chair (returned)\",\n      \"quantity\": 1,\n      \"unit\": \"H87\",\n      \"price\": {\n        \"amount\": 1500.0\n      },\n      \"vat\": {\n        \"type\": \"percent\",\n        \"amount\": 25,\n        \"code\": \"S\"\n      }\n    }\n  ],\n  \"paymentMeans\": [\n    {\n      \"code\": \"30\",\n      \"account\": {\n        \"number\": \"12345678903\"\n      }\n    }\n  ],\n  \"total\": {\n    \"amount\": 1875.0,\n    \"currency\": \"NOK\"\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/v1/credit-note",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "credit-note"]
        },
        "description": "Credits 1 of the 2 chairs on Test-INV-CN-001 and refunds to a bank account."
      }
    },
    {
      "name": "02 - Credit Note: Several Lines",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Accepted (2xx)\", function () {",
              "    pm.expect(pm.response.code).to.be.within(200, 299);",
              "});"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Authorization",
            "value": "{{apiToken}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"ref\": \"Test-CN-002\",\n  \"issued\": \"2026-11-20\",\n  \"dueDate\": \"2026-12-20\",\n  \"invoiceRefs\": [\n    \"Test-INV-CN-001\"\n  ],\n  \"customInfo\": {\n    \"nor\": {\n      \"deliveryDate\": \"2026-11-13\"\n    }\n  },\n  \"recipient\": {\n    \"name\": \"Example Buyer AS\",\n    \"taxId\": \"NO123456785MVA\",\n    \"address\": {\n      \"line1\": \"Example Street 1\",\n      \"city\": \"Oslo\",\n      \"postalCode\": \"0150\",\n      \"country\": \"NOR\"\n    },\n    \"peppolId\": {\n      \"endpointId\": \"iso6523-actorid-upis::0192:123456785\"\n    }\n  },\n  \"lines\": [\n    {\n      \"description\": \"Office chair (returned)\",\n      \"quantity\": 1,\n      \"unit\": \"H87\",\n      \"price\": {\n        \"amount\": 1500.0\n      },\n      \"vat\": {\n        \"type\": \"percent\",\n        \"amount\": 25,\n        \"code\": \"S\"\n      }\n    },\n    {\n      \"description\": \"Coffee (returned)\",\n      \"quantity\": 5,\n      \"unit\": \"KGM\",\n      \"price\": {\n        \"amount\": 120.0\n      },\n      \"vat\": {\n        \"type\": \"percent\",\n        \"amount\": 15,\n        \"code\": \"S\"\n      }\n    }\n  ],\n  \"total\": {\n    \"amount\": 2565.0,\n    \"currency\": \"NOK\"\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/v1/credit-note",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "credit-note"]
        },
        "description": "Credits 1 chair and 5 kg coffee from Test-INV-CN-001 in one credit note."
      }
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.uat.eezi.io"
    },
    {
      "key": "apiToken",
      "value": ""
    }
  ]
}
