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 Tercero model identifies a third party or recipient that issues an invoice on behalf of the primary Emisor. This corresponds to the self-billing and third-party issuance scenario defined in the VeriFactu specification, and is used in conjunction with the emitidaPorTercODestinatario flag (lista L6) on RegistroAlta. Like Destinatario, a Tercero instance is passed into RegistroAlta via its objects array. When no third party is involved, pass Tercero::empty() or simply omit the key.

Construction

use verifactuPHP\Models\Tercero;

// Domestic third-party issuer
$tercero = new Tercero([
    'tercNombreRazon' => 'Gestoría Fiscal S.L.',
    'tercNIF'         => 'B11223344',
]);

// Foreign third-party issuer
$tercero = new Tercero([
    'tercNombreRazon'  => 'Foreign Agency GmbH',
    'tercOtroCodPais'  => 'DE',
    'tercOtroIDType'   => 2,   // or the string code from lista L7
    'tercOtroID'       => 'DE123456789',
]);
Use tercNIF for Spanish third parties. For foreign third parties, populate tercOtroCodPais, tercOtroIDType, and tercOtroID instead, and leave tercNIF empty.

Fields

tercNombreRazon
string
Legal name (nombre-razón social) of the third-party issuer. Maps to API field TercNombreRazon.
tercNIF
string
Spanish NIF of the third-party issuer. Maps to API field TercNIF. Use for third parties registered with AEAT in Spain.
tercOtroCodPais
string
ISO 3166-1 alpha-2 country code for a foreign third party (e.g. "DE", "FR"). Maps to API field TercOtroCodPais.
tercOtroIDType
int|string
Foreign identification type for the third party, from lista L7. Both the integer ID and the string code are accepted. Maps to API field TercOtroIDType.
tercOtroID
string
Foreign identification number of the third party in their country of residence. Maps to API field TercOtroID.

Getters and Setters

MethodDescription
getTercNombreRazon(): stringReturns the third party’s legal name.
setTercNombreRazon(string $v): voidSets the third party’s legal name.
getTercNIF(): stringReturns the third party’s Spanish NIF.
setTercNIF(string $v): voidSets the third party’s Spanish NIF.
getTercOtroCodPais(): stringReturns the third party’s country code.
setTercOtroCodPais(string $v): voidSets the third party’s country code.
getTercOtroIDType(): int|stringReturns the foreign ID type (lista L7).
setTercOtroIDType(int|string $v): voidSets the foreign ID type (lista L7).
getTercOtroID(): stringReturns the third party’s foreign ID number.
setTercOtroID(string $v): voidSets the third party’s foreign ID number.

getArrayData()

getArrayData(): array returns an associative array containing only the non-empty fields, ready for embedding inside the Tercero key of the RegistroAlta payload. PHP property names differ from the API field names used in the payload:
PHP propertyAPI field key
tercNombreRazonTercNombreRazon
tercNIFTercNIF
tercOtroCodPaisTercOtroCodPais
tercOtroIDTypeTercOtroIDType
tercOtroIDTercOtroID
$data = $tercero->getArrayData();
// Example output:
// [
//     'TercNombreRazon' => 'Gestoría Fiscal S.L.',
//     'TercNIF'         => 'B11223344',
// ]
RegistroAlta::getArrayData() wraps the result in a single-element array under the key Tercero when the Tercero model is non-empty.

empty()

Tercero::empty(): Tercero returns a Tercero with all string fields set to '' and tercOtroIDType set to 0. Because getArrayData() skips empty values, an empty Tercero produces no output in the API payload. Use it as a placeholder in RegistroAlta when no third party is involved in the invoice issuance.
$placeholder = Tercero::empty();
When setting emitidaPorTercODestinatario on a RegistroAlta, always pair it with a populated Tercero (or Destinatario) object so the API can identify who issued the invoice.

Build docs developers (and LLMs) love