sales

PATCH /companies/{companySlug}/sales/{saleId}/writeOff

Changed on

Registers a write-off (tapsføring) for the given sale. The sale must not be a cash sale, must not already be written off, settled, or deleted, and must have an outstanding balance. The write-off date must be after the sale date.

Request

  • Base URL
    https://api.fiken.no/api/v2
  • URL
    https://api.fiken.no/api/v2/companies/{companySlug}/sales/{saleId}/writeOff
  • Auth
    OAuth 2
    Authorization code: https://fiken.no/oauth/authorize
    Token URL: https://fiken.no/oauth/token

Request body

type'OVERDUE_6_MONTHS' | 'COLLECTION_FAILED' | 'CUSTOMER_BANKRUPTCY' | 'DEEMED_IRRECOVERABLE' required

Reason for the write-off (tapsføring).

  • OVERDUE_6_MONTHS - At least 6 months past due date, and at least 3 reminders or collection notices have been sent.
  • COLLECTION_FAILED - Debt collection has been attempted without success.
  • CUSTOMER_BANKRUPTCY - The customer has been declared bankrupt and the estate cannot cover the outstanding amount.
  • DEEMED_IRRECOVERABLE - Based on an overall assessment, the receivable will clearly not be collected.
datestring date required

Date of the write-off, format yyyy-mm-dd. Must be after the sale date.

commentstring

Optional comment for the write-off.

Example request

{
  "date": "2024-06-01"
}

Response

OK

saleIdinteger

Sale Id

lastModifiedDatestring date

Date that the sale was last modified in Fiken, format yyyy-mm-dd.

transactionIdinteger
saleNumberstring

Identifier for sale.

datestring date

Due date of the invoice, format yyyy-mm-dd

kind'cash_sale' | 'invoice' | 'external_invoice'

Either cash_sale, invoice, or external_invoice.

netAmountinteger

Total net amount of the sale to be paid.

vatAmountinteger

VAT amount on sale.

settledboolean

If the sale as been marked as settled (True) or not (False).

settledDatestring date

Date the the sale was marked as settled, format yyyy-mm-dd

writeOffboolean

If a loss has been registered for this sale (tapsføring av salg).

totalPaidinteger

Total amount paid in NOK

totalPaidInCurrencyinteger

Total amount paid in other currency.

outstandingBalanceinteger
outstandingBalanceInCurrencyinteger

Outstanding balance in other currency.

currencystring

ISO 4217 currency code

dueDatestring date

Due date of the invoice, format yyyy-mm-dd

kidstring

Norwegian KID number. Number from 2 to 25 digits long.

paymentAccountstring
paymentDatestring date

Payment date of the invoice, format yyyy-mm-dd

deletedboolean

Whether the sale has been deleted or not

Example response

{
  "saleId": 2888156,
  "lastModifiedDate": "2018-04-03",
  "transactionId": 3458156,
  "saleNumber": "XK455L",
  "date": "2018-04-03",
  "kind": "external_invoice",
  "netAmount": 4500,
  "vatAmount": 5400,
  "settled": true,
  "settledDate": "2023-04-03",
  "totalPaid": 524500,
  "totalPaidInCurrency": 634550,
  "outstandingBalance": 145,
  "outstandingBalanceInCurrency": 65,
  "lines": [
    {
      "lineId": 2888156,
      "netPrice": 4500,
      "vat": 500,
      "account": "3000",
      "netPriceInCurrency": 4500,
      "vatInCurrency": 500,
      "projectId": 2815556
    }
  ],
  "customer": {
    "contactId": 2747365,
    "createdDate": "2018-04-03",
    "lastModifiedDate": "2018-04-03",
    "name": "Fiken AS",
    "email": "kontakt@fiken.gmail",
    "organizationNumber": "913312465",
    "customerNumber": 51248,
    "customerAccountCode": "1500:20001",
    "phoneNumber": "62158537",
    "memberNumber": 5464,
    "memberNumberString": "5464",
    "supplierAccountCode": "2400:20001",
    "bankAccountNumber": "11112233334",
    "contactPerson": [
      {
        "contactPersonId": 2747365,
        "name": "Betty Boop",
        "email": "bb@gmail.com",
        "phoneNumber": "98573564",
        "address": {
          "streetAddress": "Karl Johan 34",
          "streetAddressLine2": "H0405",
          "city": "Oslo",
          "postCode": "0550",
          "country": "Norway"
        }
      }
    ],
    "notes": [
      {
        "author": "Betty Boop",
        "note": "Garage 45"
      }
    ],
    "currency": "NOK",
    "language": "Norwegian",
    "inactive": true,
    "daysUntilInvoicingDueDate": 15,
    "discount": 25,
    "address": {
      "streetAddress": "Karl Johan 34",
      "streetAddressLine2": "H0405",
      "city": "Oslo",
      "postCode": "0550",
      "country": "Norway"
    },
    "documents": [
      {
        "uuid": "745b2f15-1234-4408-8bf2-b1d2d7610cb2",
        "filename": "invoice_24760.pdf",
        "identifier": "24760",
        "type": "invoice"
      }
    ]
  },
  "currency": "NOK",
  "dueDate": "2018-04-03",
  "kid": "5855454756",
  "paymentAccount": "1920:10001",
  "salePayments": [
    {
      "paymentId": 2888156,
      "date": "2018-04-03",
      "account": "1920:10001",
      "amount": 34000,
      "amountInNok": 500000,
      "currency": "NOK"
    }
  ],
  "saleAttachments": [
    {
      "uuid": "745b2f15-1234-4408-8bf2-b1d2d7610cb2",
      "filename": "invoice_24760.pdf",
      "identifier": "24760",
      "type": "invoice"
    }
  ],
  "paymentDate": "2018-04-03",
  "project": {
    "projectId": 73408306,
    "startDate": "2018-04-03",
    "endDate": "2018-04-03",
    "contact": {
      "contactId": 2747365,
      "createdDate": "2018-04-03",
      "lastModifiedDate": "2018-04-03",
      "name": "Fiken AS",
      "email": "kontakt@fiken.gmail",
      "organizationNumber": "913312465",
      "customerNumber": 51248,
      "customerAccountCode": "1500:20001",
      "phoneNumber": "62158537",
      "memberNumber": 5464,
      "memberNumberString": "5464",
      "supplierAccountCode": "2400:20001",
      "bankAccountNumber": "11112233334",
      "contactPerson": [
        {
          "contactPersonId": 2747365,
          "name": "Betty Boop",
          "email": "bb@gmail.com",
          "phoneNumber": "98573564",
          "address": {
            "streetAddress": "Karl Johan 34",
            "streetAddressLine2": "H0405",
            "city": "Oslo",
            "postCode": "0550",
            "country": "Norway"
          }
        }
      ],
      "notes": [
        {
          "author": "Betty Boop",
          "note": "Garage 45"
        }
      ],
      "currency": "NOK",
      "language": "Norwegian",
      "inactive": true,
      "daysUntilInvoicingDueDate": 15,
      "discount": 25,
      "address": {
        "streetAddress": "Karl Johan 34",
        "streetAddressLine2": "H0405",
        "city": "Oslo",
        "postCode": "0550",
        "country": "Norway"
      },
      "documents": [
        {
          "uuid": "745b2f15-1234-4408-8bf2-b1d2d7610cb2",
          "filename": "invoice_24760.pdf",
          "identifier": "24760",
          "type": "invoice"
        }
      ]
    }
  },
  "notes": [
    {
      "author": "James Jones",
      "note": "Invoice sent after telephone conversation with customer"
    }
  ]
}

Changes