You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

This document outlines the data requirements for an External Collection Service to handle collection agency file generation in a common way. The service receives a JSON request with a common schema and a target format, and produces the appropriate provider-specific file.

The common schema must contain the union of all fields needed across all supported providers and file types.


Supported Providers

ProviderClaim FormatPayment Format
Svea EkonomiFixed-width textFixed-width text
Visma CollectorsXML (VismaCollectorsAct.xsd)Fixed-width text
IntrumFixed-width textFixed-width text

All output files are encoded as iso-8859-1. The service handles encoding conversion from UTF-8 (JSON input) to iso-8859-1 (file output), including Swedish characters (å, ä, ö, etc.).


Claim Export (System → Collection Agency)

A claim export sends unpaid invoices to a collection agency for debt recovery.

Data Hierarchy

The schema follows a four-level hierarchy: file (batch metadata), debtors (customer information), invoices (the debts), and invoice lines (per-utility/billing-point breakdown).

File Level

FieldTypeDescriptionUsed By
timestampdatetimeWhen the file was generatedAll
providerenumTarget collection agencyAll
versionstringCalling system version identifierVisma
sequenceNumberintegerBatch sequence numberVisma

Creditor (Sending Company)

FieldTypeDescriptionUsed By
creditor.idstringCompany's customer number at the collection agencyAll
creditor.departmentstringConcern/department number at the agencySvea, Visma
creditor.internalReferencestringInternal reference for the creditorVisma
creditor.namestringCompany display nameSvea, Visma
creditor.legalIdentitystringCompany org numberIntrum (payments)

Debtor (Customer)

FieldTypeDescriptionUsed By
debtor.customerNumberstringCustomer's external identifierAll
debtor.namestringCustomer's full nameAll
debtor.legalIdentitystringOrganization number or personal number (10 digits). Mandatory for Intrum (validation fails if missing).All
debtor.isCompanybooleanWhether the debtor is a company or private personAll
debtor.isProtectedbooleanWhether the customer has protected identitySvea
debtor.typeenumDebtor type: Private, Company, PrivateCompany (sole proprietor)Visma
debtor.rolestringDebtor role (e.g., primary debtor)Visma

Note: The address must be the debtor's national registration address (folkbokföringsadress), not an invoice or delivery address.

FieldTypeDescriptionUsed By
debtor.address.careOfstringC/O address lineSvea, Visma
debtor.address.streetstringStreet nameAll
debtor.address.houseNumberstringHouse numberAll
debtor.address.apartmentNumberstringApartment numberAll
debtor.address.poBoxstringPO Box (alternative to street address)Svea, Intrum
debtor.address.postalCodestringPostal codeAll
debtor.address.citystringCityAll
debtor.address.countryCodestringISO country code (default SE)All
debtor.phonestringPhone numberIntrum, Visma
debtor.mobilestringMobile phone numberVisma
debtor.emailstringEmail addressSvea

Invoice

FieldTypeDescriptionUsed By
invoice.invoiceRefstringInvoice reference numberAll
invoice.invoiceDatedateWhen the invoice was issuedAll
invoice.dueDatedatePayment due dateAll
invoice.originalDueDatedateOriginal due date before any extensionsVisma
invoice.invoiceAmountdecimalOriginal invoice total amountAll
invoice.capitalAmountdecimalCapital (principal) amountAll
invoice.currentBalancedecimalCurrent outstanding balanceAll
invoice.currencystring(3)ISO currency code (e.g., SEK, NOK, EUR)All
invoice.roundingdecimalRounding amount on invoiceSvea, Intrum
invoice.expenseAmountdecimalTotal claim/reminder fee amountSvea, Intrum
invoice.interestAmountdecimalTotal interest amountSvea, Intrum
invoice.interestRatedecimalInterest rate (percentage)Svea, Visma
invoice.interestTypeenumInterest calculation type: Fixed, Percentage, PerMonth, ReferenceRateVisma
invoice.hasDelayCompensationbooleanWhether delay compensation appliesSvea, Intrum
invoice.isFinalInvoicebooleanWhether this is the customer's last invoiceSvea, Intrum
invoice.isPartiallyPaidbooleanWhether partial payments existSvea, Intrum
invoice.hasDeviatingInvoiceAddressbooleanWhether invoice was sent to a non-primary addressSvea
invoice.paymentTermDaysintegerPayment term in daysVisma
invoice.actionTypeenumCollection or ReminderVisma
invoice.debtTypestringDebt classification (e.g., Debetfaktura)Visma

Note on actionType: Visma produces separate Act blocks per action type and debtor type, meaning the same debtor can appear in multiple blocks — e.g., one for Collection + Company and one for Reminder + Company. The service groups invoices by actionType and debtor.type when generating the Visma XML.

Invoice Line (Utility/Billing Point Breakdown)

Each invoice is broken down by energy commodity and billing point. This grouping is central to Nordic energy collection.

FieldTypeDescriptionUsed By
line.utilitystring(2)Utility/commodity type code (see mapping table)All
line.amountdecimalCapital amount for this utility/billing pointAll
line.currentAmountdecimalCurrent outstanding amount after paymentsSvea
line.commentstringFree-text description for this line (e.g., "El: 735999100000012345, Storgatan 12 Stockholm")Intrum

Note: The caller sends only the real utility lines (EL, FV, VA, etc.). The service generates format-specific additional lines (e.g., Svea's KR/PA/RA lines for rounding, fees, and interest) from the invoice-level amounts (rounding, expenseAmount, interestAmount, billingFee). For Intrum, rounding is folded into the first utility line's amount rather than creating a separate record.

Note: Visma uses only the highest-amount billing point per invoice for its Property section. The service selects it from the provided lines.

Billing Point

Each invoice line may include information about the physical billing point.

FieldTypeDescriptionUsed By
billingPoint.externalIdstringExternal identifier for the metering/billing pointAll
billingPoint.addressstringFull billing point address (composed)Svea, Intrum
billingPoint.streetstringStreet addressVisma
billingPoint.postalCodestringPostal codeVisma
billingPoint.citystringCityVisma
billingPoint.countryCodestringCountry codeVisma
billingPoint.meterIdstringPhysical meter identifierSvea, Visma
billingPoint.netAreastringNetwork area codeSvea, Intrum
billingPoint.regionCodestringRegion/district code ("Lan")Svea, Intrum
billingPoint.areaCodestringMunicipality/community code ("Kommun")Svea, Intrum
billingPoint.netOwnerIdstringNetwork owner identifierVisma
billingPoint.annualConsumptiondecimalAnnual consumption estimateSvea, Intrum
billingPoint.isDisconnectedbooleanWhether the billing point is disconnectedAll
billingPoint.disconnectedDatedateWhen disconnection occurredSvea, Intrum
billingPoint.hasMovedbooleanWhether the customer has movedSvea, Intrum
billingPoint.movedDatedateWhen the customer movedSvea, Intrum

Costs (Claim Fees)

FieldTypeDescriptionUsed By
cost.typeenumClaim, Reminder, or LateFeeVisma, Intrum
cost.datedateWhen the cost was incurredVisma, Intrum
cost.amountdecimalCost amountVisma, Intrum
cost.currentAmountdecimalCurrent outstanding cost amountVisma
cost.invoiceRefstringRelated invoice referenceIntrum

The service maps cost.type to provider-specific strings:

cost.typeVisma Cost.Name
Claim"Krav"
Reminder"Påminnelse"
LateFee"Förseningavgift"

The service maps invoice.interestType to Visma XSD values:

interestType enumVisma InterestType
FixedFAST
PercentagePER
PerMonthPERMÅN
ReferenceRateÖGR

Billing Fee

FieldTypeDescriptionUsed By
billingFee.amountdecimalInvoice billing fee (VAT-inclusive)Svea
billingFee.transferredAmountdecimalSum of billing fees from transferred/consolidated invoices (VAT-inclusive)Svea

Payment Export (System → Collection Agency)

After invoices have been sent to collection, the system reports payments and credits received on those invoices.

File Level

FieldTypeDescriptionUsed By
timestampdatetimeWhen the file was generatedAll
providerenumTarget collection agencyAll
creditor.idstringCompany's payment customer number at the agencyAll
creditor.departmentstringConcern/department numberSvea, Visma
creditor.namestringCompany nameSvea, Visma
creditor.legalIdentitystringCompany org numberIntrum

Payment Record

FieldTypeDescriptionUsed By
payment.invoiceRefstringInvoice reference the payment applies toAll
payment.amountdecimalPayment amountAll
payment.datedateWhen the payment was recordedAll
payment.currencystring(3)ISO currency codeSvea
payment.typeenumPayment or Credit (settlement between invoices)Svea, Visma
payment.currentBalancedecimalInvoice balance after this paymentSvea, Intrum
payment.customerNumberstringCustomer external IDSvea, Intrum
payment.customerNamestringCustomer nameSvea
payment.customerLegalIdentitystringCustomer org/personal number (10 digits)Intrum
payment.settledFromInvoiceRefstringSource invoice ref (for cross-invoice settlements)Svea
payment.settledFromInvoiceDatedateSource invoice dateSvea
payment.paidCapitaldecimalCapital portion of the paymentIntrum
payment.paidExpensesdecimalExpense/fee portion of the paymentIntrum
payment.paidInterestdecimalInterest portion of the paymentIntrum
payment.remainingCapitaldecimalRemaining capital balance after paymentIntrum
payment.invoiceCreditedbooleanWhether the invoice this payment belongs to is credited (only one payment per invoice should set this to true to avoid duplicate credit records)Intrum
payment.creditCommentstringFree-text credit note (e.g., "Fakturan krediterad")Intrum

Note on Intrum payment breakdown: The paidCapital/paidExpenses/paidInterest split requires the caller to compute how a lump payment is distributed across capital, expenses, and interest. This typically involves balance calculations at the date the invoice was sent to collection. The service does not compute this split — the caller must provide it.

Note on currentBalance: The balance calculation may differ by provider. For example, Svea uses a provider-specific calculation based on both the payment creation time and the date the invoice was sent to collection. The caller is responsible for providing the correct balance per their business rules.


Response Contract

The service returns the generated file content. Format TBD — options:

  1. Raw bytes — the caller receives the file content and handles storage/delivery
  2. Base64-encoded string — file content as a JSON-friendly string with metadata (filename, content type, encoding)

Summary totals, record counts, and checksum records within the files are computed by the service — they are not part of the request schema.

Amount formatting: All amounts in the JSON are standard decimals (e.g., 12500.00). The service converts to the format required by each provider — fixed-width formats use öre (amount × 100, no decimals, e.g., 1250000).


Utility Type Mapping

The utility code identifies the energy commodity type. The common schema uses a 2-character code:

CodeDescription (Swedish)Description (English)Intrum Numeric Code
ELEl (handel)Electricity (trading)02
ENElnatElectricity (grid/network)01
EHElhandelElectricity (trading, alt)02
FVFjarrvarmeDistrict heating08
VAVattenWater07
BBBredbandBroadband15
RHRenhallningWaste management09
KDKundspecifikCustomer-specific99

Note: Some formats require additional synthetic line types for fees, rounding, and interest (e.g., Svea's KR, PA, RA records). These are generated by the service from the invoice-level amount fields — callers do not need to send them.


Example Schema

Claim Export

Core fields always present, provider-specific fields nullable. The service computes summary totals, record counts, and format-specific transformations (e.g., Intrum numeric utility codes) from this input.

{
  "type": "claim",
  "format": "SVEA",
  "timestamp": "2025-03-10T08:30:00Z",
  "version": "3.2.1",
  "sequenceNumber": 0,
  "creditor": {
    "id": "1234567",
    "department": "001",
    "internalReference": "REF-001",
    "name": "Energibolaget AB",
    "legalIdentity": "5561234567"
  },
  "debtors": [
    {
      "customerNumber": "K-900123",
      "name": "Anna Johansson",
      "legalIdentity": "8501011234",
      "isCompany": false,
      "isProtected": false,
      "type": "Private",
      "role": "Huvudgäldenär",
      "address": {
        "careOf": null,
        "street": "Storgatan",
        "houseNumber": "12",
        "apartmentNumber": "1102",
        "poBox": null,
        "postalCode": "11122",
        "city": "Stockholm",
        "countryCode": "SE"
      },
      "phone": "0812345678",
      "mobile": "0701234567",
      "email": "anna.johansson@example.com",
      "invoices": [
        {
          "invoiceRef": "2025001234",
          "invoiceDate": "2025-01-15",
          "dueDate": "2025-02-15",
          "originalDueDate": "2025-02-15",
          "invoiceAmount": 12500.00,
          "capitalAmount": 11800.00,
          "currentBalance": 12500.00,
          "currency": "SEK",
          "rounding": -0.50,
          "expenseAmount": 180.00,
          "interestAmount": 45.00,
          "interestRate": 0,
          "interestType": "PerMonth",
          "isFinalInvoice": false,
          "isPartiallyPaid": false,
          "hasDeviatingInvoiceAddress": false,
          "hasDelayCompensation": false,
          "paymentTermDays": 31,
          "actionType": "Collection",
          "debtType": "Debetfaktura",
          "billingFee": {
            "amount": 45.00,
            "transferredAmount": 0
          },
          "lines": [
            {
              "utility": "EL",
              "amount": 8500.00,
              "currentAmount": 8500.00,
              "comment": "El: 735999100000012345, Storgatan 12 Stockholm",
              "billingPoint": {
                "externalId": "735999100000012345",
                "address": "Storgatan 12 Stockholm 11122 SE",
                "street": "Storgatan 12",
                "postalCode": "11122",
                "city": "Stockholm",
                "countryCode": "SE",
                "meterId": "MET-12345",
                "netArea": "SN1",
                "regionCode": "01",
                "areaCode": "180",
                "netOwnerId": "ELNAT-001",
                "annualConsumption": 15000,
                "isDisconnected": false,
                "disconnectedDate": null,
                "hasMoved": false,
                "movedDate": null
              }
            },
            {
              "utility": "FV",
              "amount": 3300.00,
              "currentAmount": 3300.00,
              "comment": "Fjärrvärme: 735999100000054321, Storgatan 12 Stockholm",
              "billingPoint": {
                "externalId": "735999100000054321",
                "address": "Storgatan 12 Stockholm 11122 SE",
                "street": "Storgatan 12",
                "postalCode": "11122",
                "city": "Stockholm",
                "countryCode": "SE",
                "meterId": "MET-54321",
                "netArea": null,
                "regionCode": "01",
                "areaCode": "180",
                "netOwnerId": null,
                "annualConsumption": null,
                "isDisconnected": false,
                "disconnectedDate": null,
                "hasMoved": false,
                "movedDate": null
              }
            }
          ],
          "costs": [
            {
              "type": "Reminder",
              "date": "2025-02-20",
              "amount": 60.00,
              "currentAmount": 60.00,
              "invoiceRef": "2025001234"
            },
            {
              "type": "Claim",
              "date": "2025-03-05",
              "amount": 180.00,
              "currentAmount": 180.00,
              "invoiceRef": "2025001234"
            }
          ]
        }
      ]
    },
    {
      "customerNumber": "K-800456",
      "name": "Fastigheter i Norr AB",
      "legalIdentity": "5567891234",
      "isCompany": true,
      "isProtected": false,
      "type": "Company",
      "role": "Huvudgäldenär",
      "address": {
        "careOf": null,
        "street": "Industrivägen",
        "houseNumber": "5",
        "apartmentNumber": null,
        "poBox": null,
        "postalCode": "90325",
        "city": "Umeå",
        "countryCode": "SE"
      },
      "phone": "0901234567",
      "mobile": null,
      "email": null,
      "invoices": [
        {
          "invoiceRef": "2025005678",
          "invoiceDate": "2024-12-01",
          "dueDate": "2025-01-01",
          "originalDueDate": "2025-01-01",
          "invoiceAmount": 45200.00,
          "capitalAmount": 44000.00,
          "currentBalance": 25200.00,
          "currency": "SEK",
          "rounding": 0,
          "expenseAmount": 600.00,
          "interestAmount": 120.00,
          "interestRate": 0,
          "interestType": "PerMonth",
          "isFinalInvoice": false,
          "isPartiallyPaid": true,
          "hasDeviatingInvoiceAddress": false,
          "hasDelayCompensation": true,
          "paymentTermDays": 31,
          "actionType": "Collection",
          "debtType": "Debetfaktura",
          "billingFee": {
            "amount": 0,
            "transferredAmount": 0
          },
          "lines": [
            {
              "utility": "VA",
              "amount": 44000.00,
              "currentAmount": 24000.00,
              "comment": "Vatten: 735999200000099887, Industrivägen 5 Umeå",
              "billingPoint": {
                "externalId": "735999200000099887",
                "address": "Industrivägen 5 Umeå 90325 SE",
                "street": "Industrivägen 5",
                "postalCode": "90325",
                "city": "Umeå",
                "countryCode": "SE",
                "meterId": "MET-99887",
                "netArea": null,
                "regionCode": "24",
                "areaCode": "280",
                "netOwnerId": null,
                "annualConsumption": null,
                "isDisconnected": true,
                "disconnectedDate": "2025-02-15",
                "hasMoved": false,
                "movedDate": null
              }
            }
          ],
          "costs": [
            {
              "type": "Claim",
              "date": "2025-02-01",
              "amount": 600.00,
              "currentAmount": 600.00,
              "invoiceRef": "2025005678"
            }
          ]
        }
      ]
    }
  ]
}

Payment Export

{
  "type": "payment",
  "format": "INTRUM",
  "timestamp": "2025-03-10T09:00:00Z",
  "creditor": {
    "id": "7654321",
    "department": null,
    "name": "Energibolaget AB",
    "legalIdentity": "5561234567"
  },
  "payments": [
    {
      "invoiceRef": "2025005678",
      "amount": 20000.00,
      "date": "2025-03-08",
      "currency": "SEK",
      "type": "Payment",
      "currentBalance": 25200.00,
      "customerNumber": "K-800456",
      "customerName": "Fastigheter i Norr AB",
      "customerLegalIdentity": "5567891234",
      "settledFromInvoiceRef": null,
      "settledFromInvoiceDate": null,
      "paidCapital": 19500.00,
      "paidExpenses": 400.00,
      "paidInterest": 100.00,
      "remainingCapital": 24500.00,
      "invoiceCredited": false,
      "creditComment": null
    },
    {
      "invoiceRef": "2025001111",
      "amount": 5500.00,
      "date": "2025-03-09",
      "currency": "SEK",
      "type": "Credit",
      "currentBalance": 0,
      "customerNumber": "K-800456",
      "customerName": "Fastigheter i Norr AB",
      "customerLegalIdentity": "5567891234",
      "settledFromInvoiceRef": "2025002222",
      "settledFromInvoiceDate": "2025-01-15",
      "paidCapital": 5500.00,
      "paidExpenses": 0,
      "paidInterest": 0,
      "remainingCapital": 0,
      "invoiceCredited": true,
      "creditComment": "Fakturan krediterad"
    }
  ]
}

Format Differences Summary

AspectSveaVismaIntrum
Claim formatFixed-width textXML (XSD)Fixed-width text
Payment formatFixed-width textFixed-width textFixed-width text
Creditor ID length7 chars6 charsVariable
Department length3 chars4 charsN/A
Action typeImplicitInkasso / PaminnelseImplicit
Debtor typeJ/N/S (company/no/protected)Privatperson/Foretag/Enskild firma1 (consumer) / 2 (company)
Utility code format2-char text2-char text (ChargeType)Numeric codes
Interest handlingSeparate RA lineInterestPercentage + InterestTypeSeparate record type 12
Expense handlingSeparate PA lineCost sections per claimSeparate record type 14
Payment breakdownLump sumLump sumSplit into capital/expenses/interest
Credit handlingNot explicitNot explicitExplicit credit records with comment
PhoneNot includedIncludedIncluded
EmailIncluded (100 chars)Not includedNot included
  • No labels