Invoices, eInvoice and EHF
Invoices have several types, we have Simple Invoice and Managed Invoice. What to choose depends on your use-case.
Simple invoice
When creating a PaymentIntent with the PaymentGateway: “invoice“ the invoice is treated as a Simple Invoice. We do not require a lot of information for this type, this is because you take charge of the actions needed on this invoice, we just process the payment.
With this minimal information we can not do the following:
-
Create an invoice-pdf
-
Follow up with debt collection
-
Provide the customer with detailed information about the purchase
-
Send EInvoice or EHF
This will all be in your hands. If any of the features above is necessary, the Managed Invoice is necessary
Managed Invoice
A Managed Invoice can be created in a few ways. Firstly, we can explicitly set it as PaymentGateway: “managedInvoice“ or if the customer chooses the PaymentMethod:"invoice" in the checkout. This means that we require the orderDetails-property to be set, and product-lines describing the products in this Order. This allows us to create an invoice-pdf which we can send through the appropriate channels (email, eInvoice, EHF, Digipost).
// Required for paymentGateway:"managedInvoice"
// Optional for "checkout" and "invoice"
"invoiceOptions": {
// Property for both Simple and Managed Invoice
"dueDate": "2026-10-01", // needs to be at least 3 days into the future
// Property for only Managed Invoices
"followUpPolicy": "DebtCollection", // or "none" to disable debt-collection
// Properties only for when paymentGateway is explicitly set
// to ManagedInvoice.
// This is because we get the necessary information to send an eInvoice
// when the user completes the checkout.
// Choose either "eInvoice" or "EHF", not both.
"eInvoice": {
// The customers unique eInvoiceIdentifier, this can be gotten from
// `POST /customers/einvoice-identifier`
"eInvoiceIdentifierReferenceID": "d6918377-477b-44ba-8f82-d90d95b0ceda"
},
"EHF": {
"organizationNumber": "123456789",
"countryCode": "NO"
}
},
...the rest of "Create payment intent"-properties
Managed Invoice is a term used for both checkout-payments where the customer chooses the invoice paymentMethod and when set explicitly through paymentGateway:”managedInvoice”
managedInvoice is only used to reference the paymentGateway.
Credit note
Credit notes are automatically sent to customers that have already received an EHF when a change on the invoice occurs. Meaning that when either a partial or full refund occurs, both from API-calls and through our embeddables view for merchants, a credit note will be sent to keep the financials in sync.
Invoice-urls
With a Managed Invoice we will generate an Invoice url which we will send automatically to the customer. This url can also be found on the paymentIntent.kidNorwayInvoice.invoiceUrl-property if you need to get the url yourselves. It looks like this:
https://pay.paybucky.com/{paymenReferenceID}/invoice
The url will always stay up-to-date with the current state of the payment, meaning that it will include any refunds, extra charges etc.
As keeping the invoice up-to-date is not always preffered, you can use the v -query parameter to define which version of the invoice to show.
When a refund happens, or extra charges are applied, the productLines reflecting these changes are automatically added to orderDetails with a productLines.paymentVersionNumber-property declaring which version this belongs to. When a change happens, the paymentVersion is incremented. If you want the original invoice you can add ?v=1 , version 1 is always the original and nothing more. Omitting this parameter will always lead to the latest. For example:
https://pay.paybucky.com/{paymenReferenceID}/invoice?v=1
If you want to view the version history, the information is in the paymentIntent.orderDetails.productLines.[index].paymentVersionNumber-property.
https://pay.paybucky.com/f34fa6ab-c691-449f-8d59-9c9dc1082521/invoice
