Skip to content

verifactu-sdk API


verifactu-sdk API / buildQrUrl

Function: buildQrUrl()

buildQrUrl(input): string

Defined in: src/qr/buildUrl.ts:178

Build the AEAT tax-QR URL for an invoice.

The function is pure: it does no I/O. All parameter values are URL-encoded with encodeURIComponent so that characters allowed by the AEAT in numserie (slashes, spaces, ampersands, …) round-trip correctly through the QR reader and HTTP layer.

Parameters

input

BuildQrUrlInput

Validated invoice identification data (see BuildQrUrlInput).

Returns

string

The fully-formed validation URL ready to be encoded into a QR.

Throws

If any of the input fields fails the AEAT format check (NIF length/charset, ISO date, ASCII-only numserie within 60 chars, importe shape, language code).

See

QR spec v0.5.0 §5–8

Example

ts
const url = buildQrUrl({
  nif: '89890001K',
  numSerieFactura: '12345678-G33',
  fechaExpedicionFactura: '2024-09-01',
  importeTotal: '241.4',
  mode: 'verifactu',
  environment: 'production',
});
// → "https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR?nif=89890001K&numserie=12345678-G33&fecha=01-09-2024&importe=241.4"

Released under the MIT license.