Invoices
Invoices booked in your accounting provider for payments and subscription periods. Void them, mark them paid or email them to the payer.
Invoices are created by Borga when a payment succeeds, a bank invoice is issued or a subscription period ends, and mirrored to PayDay or DK+. See Invoicing. You cannot create or edit them through the API; add one-off charges to a subscription with invoice items. You can void an open invoice, mark one paid when the money arrived outside Borga, and email an invoice to the payer.
The invoice object
inv_.draft, open, paid, void or sync_failed.total less credit_applied: what is collected. 0 when credit covered the invoice, which is then paid at once.payday or dk.null for up to a minute, including in invoice.created and invoice.finalized events; retrieving the invoice reads it from PayDay.status is sync_failed.name, email, kennitala, vat_number, address used on the invoice.exempt or reverse when every line booked at 0%, otherwise null.tax_rate, taxable_amount (the net at that rate) and tax_amount.id, description, quantity, unit_amount (including tax), unit_amount_excluding_tax, tax_behavior (exclusive when the line came from a net price, item or line item), tax_rate, tax_amount (the tax inside the line), accounting_code, and for subscription lines the service period as period_start, period_end and proration_factor (1 for a whole period, the fraction billed otherwise; null on one-off lines).YYYY-MM-DD the bank claim is due.payment_reference (KID) and creditor_account (IBAN, when the provider reports it).true when it was marked paid outside Borga.Retrieve an invoice
curl https://api.borga.is/v1/invoices/inv_3Ef5Gh7Ij9Kl1Mn3Op5Qr7St \
-H "Authorization: Bearer sk_test_…"List invoices
Query parameters
const { data, has_more } = await borga.invoices.list({ status: "paid", limit: 50 });
for (const invoice of data) {
console.log(invoice.external_invoice_number, invoice.total, invoice.pdf_url);
}
if (has_more) {
const next = await borga.invoices.list({
status: "paid",
starting_after: data[data.length - 1].id,
});
console.log(next.data.length);
}Void an invoice
Voids an open invoice so it can no longer be paid, and stops any payment retries for it. A subscription that was past_due because of it becomes active again. Sends invoice.voided.
With PayDay, Borga cancels the invoice in PayDay first, which also cancels its bank claim, so the payer can no longer pay it in their online bank. If the payer has already paid the claim, the request fails with provider_error and Borga marks the invoice paid on its next check of the claim. DK+ invoices are voided in Borga only; cancel the invoice in DK+ as well.
A paid invoice cannot be voided (invoice_not_voidable); refund the payment instead. An invoice that failed to sync and never collected money can be voided.
curl -X POST https://api.borga.is/v1/invoices/inv_3Ef5Gh7Ij9Kl1Mn3Op5Qr7St/void \
-H "Authorization: Bearer sk_test_…"Mark an invoice paid
Records that an open invoice was paid outside Borga, for example by bank transfer or in cash. Nothing is charged. Borga marks the invoice paid in your accounting provider, which also settles a PayDay bank claim, and sends invoice.paid with paid_out_of_band: true. A bank invoice from checkout also sends payment.succeeded for its payment.
Body
true.curl -X POST https://api.borga.is/v1/invoices/inv_3Ef5Gh7Ij9Kl1Mn3Op5Qr7St/pay \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{ "paid_out_of_band": true }'Send an invoice
Emails the invoice PDF from your accounting provider to the payer's billing email, or the customer's email when the invoice has none. Replies go to your merchant email. For an open invoice the email says how to pay: the bank claim's reference and due date, or a "Pay now" link to the customer portal that works for 24 hours when the invoice can be paid by card there. Works for open and paid invoices, at most once a minute per invoice. In test mode the subject starts with [Test]. Sends invoice.sent.
curl -X POST https://api.borga.is/v1/invoices/inv_3Ef5Gh7Ij9Kl1Mn3Op5Qr7St/send \
-H "Authorization: Bearer sk_test_…"