Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eseperio/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
InvoiceQuery (XSD base: ConsultaFactuSistemaFacturacionType) defines the filter parameters for querying invoice records from AEAT. It extends the abstract Model class directly (not InvoiceRecord).
Verifactu::queryInvoices(), which returns a QueryResponse.
Properties
Required fields
The fiscal year to query (
Ejercicio). Four-digit year string. Example: '2025'The period within the year (
Periodo). Typically a two-digit month string. Example: '01' for January, '12' for December.Optional filter fields
Filters results to invoices matching this series + number (
NumSerieFactura, optional). Example: 'A-2025/001'Filters results to invoices with this issue date (
FechaExpedicionFactura, optional). Format: YYYY-MM-DD.Filters by the external reference stored on the record (
RefExterna, optional). Must match the value set via InvoiceSubmission::$externalRef at submission time.Methods
setIssuerparty(string $nif, string|null $name = null): static
Sets the issuer party (ObligadoEmision) for the query header. This method must be called before submitting the query — the XML serialiser includes the issuer party unconditionally and will fail without it. The $name parameter is optional but recommended.
The NIF of the issuing party to filter on.
Optional name of the issuing party.
getIssuerparty() to read back the stored array.
setCounterparty(string $nif, string|null $name = null): static
Sets the counterparty (recipient) filter (Contraparte, optional). Restricts results to invoices issued to the specified recipient NIF.
The NIF of the recipient to filter on.
Optional name of the recipient.
getCounterparty() to read back the stored array.
setSystemInfo(string $system, string $version): static
Restricts the query to records from a specific billing software (SistemaInformatico, optional). Both the system name and version must match what was submitted with the original records.
The billing system name (
NombreSistemaInformatico).The billing system version (
Version).getSystemInfo() to read back the stored array.
setPaginationKey(int $page, int $size): static
Sets the pagination control values (ClavePaginacion) for retrieving subsequent pages of results. Pass the page number and page size to advance through large result sets.
The page number to retrieve (1-based).
The number of records per page.
getPaginationKey() to read back the stored array.
validate(): array
Validates the query properties. Returns an empty array when year and period are present and all other set properties are the correct types. Returns an error array otherwise.
QueryResponse fields
Verifactu::queryInvoices() returns a QueryResponse object. The most important properties are:
Overall result of the query (
ResultadoConsulta). Common values:| Value | Meaning |
|---|---|
'ConDatos' | Records were found matching the query |
'SinDatos' | No records matched the query criteria |
Array of matching invoice record objects (
RegistroRespuestaConsultaFactuSistemaFacturacion). Each element is an associative array of the raw AEAT response fields. May be null or empty when queryResult is 'SinDatos'.Pagination indicator (
IndicadorPaginacion). Set to 'S' when there are more pages of results available.Raw pagination cursor data (
ClavePaginacion) returned by AEAT. This is the raw XML-to-array representation of the last record seen. Only present when paginationIndicator is 'S'. To fetch the next page, call $query->setPaginationKey($nextPage, $pageSize) with your desired page number and size.Response header data (
Cabecera) from AEAT. Contains metadata about the query response.Period to which the found records belong (
PeriodoImputacion).