e-copedia hjælpecenter

Booking and sending sales invoices through the e-conomic API

Sidst opdateret:
Skrevet af Charles J

The e-conomic REST API allows an invoice to be booked and optionally sent as part of the same request.

Invoices can be delivered through:

  • Email

  • Electronic invoicing through EAN, CVR, P-number, or PEPPOL

  • No delivery, where the invoice is only booked

This guide explains how to select the delivery method, prepare the customer and invoice correctly, and retrieve the available delivery status.

Obs

💡 Sending sales documents can only be achieved via our RESTAPI until further notice.

Before Sending an Electronic Invoice

Before you can send an electronic invoice, make sure the following is in place:

  1. Sender's company CVR number and country are registered in your master data. The CVR number must be a Danish CVR as well.

  2. The customer has a valid electronic recipient identifier (EAN number, CVR number, Peppol ID, or P-number) entered on their customer.

  3. The NemHandel type on the customer is set to match that identifier.

  4. The recipient is registered and active in NemHandel.

  5. The invoice has at least one product line.

  6. The customer is not barred and has not opted out of receiving electronic invoices.

Booking and Sending an Invoice

A draft invoice is booked through:

POST /invoices/booked

The minimum request identifies the draft invoice to be booked:

{
"draftInvoice": {
"draftInvoiceNumber": {draftInvoiceNumber}
}
}

To send the invoice immediately after it has been booked, include the sendBy property:

{
"draftInvoice": {
"draftInvoiceNumber": {draftInvoiceNumber}
},
"sendBy": "Email"
}

The invoice is only sent if the booking operation succeeds.

The supported values for sending document are:

Value

Behaviour

none

Books the invoice without sending it

Email

Books the invoice and sends it by email

ean

Books the invoice and sends it as an electronic invoice

If sendBy is omitted, the invoice is booked without being sent.

Electronic Invoicing

Use:

{
"draftInvoice": {
"draftInvoiceNumber": {draftInvoiceNumber} },
"sendBy": "ean"
}

for electronic invoicing.

Despite the name, ean does not exclusively refer to delivery using an EAN number.

The value originates from a time when electronic invoices to an EAN was the only method of sending via the API. Electronic invoicing has since been expanded to support additional recipient types.

In practice, sendBy: "ean" in the REST API means:

Book and send this document as an electronic invoice.

It is therefore also used when sending electronically through:

  • A CVR or company registration number

  • A P-number

  • PEPPOL

  • An EAN number

The actual electronic recipient type is determined by the NemHandel configuration on the customer and invoice.

Configuring the Electronic Recipient

Before sending an electronic invoice, verify how the customer is configured to receive it.

Retrieve the customer using our customersAPI

Inspect the customer's configured NemHandel receiver type and the corresponding recipient identifier.

The receiver type determines which value e-conomic validates when sending the invoice.

The nemHandelReceiveType can be identified as follows

nemHandelReceiverType

Recipient identifier via responseBody

EAN No.

0

Company registration number

1

P-number

2

PEPPOL

4

If the customer is configured for EAN delivery, e-conomic validates that an EAN number is present.

If the intention is to send through CVR, but the customer's receiver type is still configured for EAN, the request may fail because e-conomic expects an EAN number on the invoice.

The specific customer setup must correspond to the intended electronic invoicing address.

Var denne artikel nyttig?