Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/NemonInvocash/verifactu-php/llms.txt

Use this file to discover all available pages before exploring further.

The Destinatario model identifies the party that receives an invoice. It supports both domestic recipients (identified by a Spanish NIF) and foreign recipients (identified by a country code, an ID type from lista L7, and a foreign identification number). A Destinatario instance is passed into RegistroAlta via its objects array; when the invoice has no identifiable recipient, pass Destinatario::empty() or omit the key entirely.

Construction

use verifactuPHP\Models\Destinatario;

// Domestic recipient
$destinatario = new Destinatario([
    'nombreRazon' => 'Empresa Compradora S.A.',
    'nif'         => 'A98765432',
]);

// Foreign recipient
$destinatario = new Destinatario([
    'nombreRazon'  => 'Foreign Corp Ltd',
    'otroCodPais'  => 'GB',
    'otroIDType'   => 2,   // or the string code from lista L7
    'otroID'       => 'GB123456789',
]);
For Spanish recipients, populate nif. For foreign recipients, leave nif empty and populate otroCodPais, otroIDType, and otroID instead. Both sets of fields can coexist in the array but only the relevant subset will be forwarded to the API by getArrayData().

Fields

nombreRazon
string
Recipient’s name or company name (nombre-razón social). Maps to API field NombreRazon.
nif
string
Recipient’s Spanish tax identification number. Maps to API field NIF. Use for domestic recipients registered with AEAT.
otroCodPais
string
ISO 3166-1 alpha-2 country code for foreign recipients (e.g. "FR", "DE", "GB"). Maps to API field OtroCodPais.
otroIDType
int|string
Foreign identification type, taken from lista L7. Both the integer ID and the string code are accepted. Maps to API field OtroIDType. Required when otroID is populated.
otroID
string
Foreign identification number (passport, VAT number, etc.) for the recipient in their country of residence. Maps to API field OtroID.

Getters and Setters

MethodDescription
getNombreRazon(): stringReturns the recipient’s name or company name.
setNombreRazon(string $v): voidSets the recipient’s name or company name.
getNif(): stringReturns the recipient’s Spanish NIF.
setNif(string $v): voidSets the recipient’s Spanish NIF.
getOtroCodPais(): stringReturns the foreign country code.
setOtroCodPais(string $v): voidSets the foreign country code.
getOtroIDType(): int|stringReturns the foreign ID type (lista L7).
setOtroIDType(int|string $v): voidSets the foreign ID type (lista L7).
getOtroID(): stringReturns the foreign identification number.
setOtroID(string $v): voidSets the foreign identification number.

getArrayData()

getArrayData(): array returns an associative array containing only the fields that have non-empty values, ready to be embedded inside the Destinatarios key of the RegistroAlta payload. PHP property names differ from the API field names used in the payload:
PHP propertyAPI field key
nombreRazonNombreRazon
nifNIF
otroCodPaisOtroCodPais
otroIDTypeOtroIDType
otroIDOtroID
$data = $destinatario->getArrayData();
// Example output for a domestic recipient:
// [
//     'NombreRazon' => 'Empresa Compradora S.A.',
//     'NIF'         => 'A98765432',
// ]
RegistroAlta::getArrayData() wraps the result in a single-element array under the key Destinatarios, matching the API’s expected structure.

empty()

Destinatario::empty(): Destinatario returns a Destinatario with all string fields set to '' and otroIDType set to 0. Use it as a safe no-op placeholder inside RegistroAlta when the invoice type does not require an identified recipient (e.g. simplified invoices under Art. 61d).
$placeholder = Destinatario::empty();

Build docs developers (and LLMs) love