Skip to content

Payment

How the buyer pays: payment instructions (BG-16) with a means code from UNCL4461, payment terms (BT-20), the due date (BT-9) and amounts already paid. The snippets extend the base invoice.

Credit transfer

Codes 30 (credit transfer) and 58 (SEPA credit transfer) need the account to pay into (BT-84). paymentId (BT-83) is the text the buyer quotes, so you can match the payment.

ts
const creditTransfer: InvoiceInput['paymentMeans'] = [
  {
    paymentMeansCode: { value: '30', name: 'Credit transfer' }, // UNCL4461
    paymentId: 'Snippet1', // remittance information the buyer quotes when paying
    payeeFinancialAccount: {
      id: 'NO9386011117947', // IBAN
      name: 'SupplierOfficialName Ltd',
      financialInstitutionBranch: { id: 'DNBANOKK' }, // BIC
    },
  },
];

Card

State only the last digits of the card number (BT-87), never the full number.

ts
const card: InvoiceInput['paymentMeans'] = [
  {
    paymentMeansCode: { value: '48', name: 'Bank card' },
    cardAccount: {
      primaryAccountNumberId: '1234', // only the last digits, never the full card number
      networkId: 'VISA',
      holderName: 'Lisa Johnson',
    },
  },
];

Direct debit

A direct debit needs the mandate reference (BT-89), and usually the account to debit (BT-91).

ts
const directDebit: InvoiceInput['paymentMeans'] = [
  {
    paymentMeansCode: { value: '59', name: 'SEPA direct debit' },
    paymentMandate: {
      id: 'MANDATE-4711', // mandate reference (BT-89)
      payerFinancialAccount: { id: 'SE8750000000054910000003' }, // debited account (BT-91)
    },
  },
];

Terms and due date

An invoice with an amount due needs a due date or payment terms.

ts
const terms: Partial<InvoiceInput> = {
  dueDate: '2017-12-13',
  paymentTerms: { note: 'Payment within 30 days, 2 % discount within 10 days' },
};

Prepaid amount and rounding

State what was paid in advance (BT-113) and any rounding (BT-114); the builder subtracts and adds them.

ts
const prepaid = createInvoice({
  ...baseInvoice,
  legalMonetaryTotal: {
    prepaidAmount: 1000, // already paid (BT-113)
    payableRoundingAmount: 0.3, // rounding (BT-114)
  },
});

const due = prepaid.legalMonetaryTotal.payableAmount.value; // '2500.30': 3500.00 − 1000.00 + 0.30

Computed: payableAmount (BT-115) = taxInclusiveAmountprepaidAmount + payableRoundingAmount.

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.