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.

verifactuPHP is an open-source PHP library built by Invocash that wraps the VeriFactuAPI — Spain’s electronic invoicing platform — into a clean, object-oriented interface. It handles token authentication automatically and provides factory methods and model classes for every resource you need to register, submit, and cancel electronic invoices in compliance with Spain’s new fiscal regulations.

Quickstart

Authenticate, register an issuer, and submit your first invoice in minutes.

Installation

Install via Composer using either the VCS repository method or git clone.

API Reference

Complete reference for every method on ClienteVerifactu and all models.

Guides

Step-by-step guides for managing emisores, invoices, cancellations, and webhooks.

What is VeriFactu?

VeriFactu is Spain’s mandatory electronic invoicing system operated by the AEAT (Agencia Estatal de Administración Tributaria). Under Spain’s new electronic invoicing legislation, billing software must be able to validate and submit electronic invoices through VeriFactu. verifactuPHP makes this requirement straightforward to fulfil in any PHP application.
You need a VeriFactuAPI account to use this library. Register at verifactuapi.es to obtain your API credentials.

Key Capabilities

Token Authentication

Automatically logs in with your email and password on construction and stores the Bearer token for all subsequent requests.

Invoice Registration

Build and submit RegistroAlta records for standard, simplified, and rectified invoices directly to AEAT.

Invoice Cancellation

Cancel invoice records using bajaRegistro (by ID) or a full RegistroAnulacion object.

Webhook Support

Register webhooks to receive real-time POST notifications when invoice records are processed.

Full VAT/IGIC Breakdown

Model detailed tax breakdowns with Desglose, supporting IVA, IGIC, tax regimes, exempt operations, and surcharges.

PHP 7.4 & 8.x

Compatible with PHP 7.4 and all PHP 8.x versions. Uses Guzzle for HTTP transport.

Quick Example

quickstart.php
<?php
require 'vendor/autoload.php';

use verifactuPHP\ClienteVerifactu;

// Authenticate — token is obtained automatically on construction
$client = new ClienteVerifactu('you@example.com', 'your-password');

// Create an issuer object
$emisor = $client->nuevoEmisor([
    'nif'        => 'A39200019',
    'nombre'     => 'Mi Empresa S.L.',
    'enviarAeat' => true,
]);

// Register the issuer with VeriFactuAPI
$client->altaEmisor($emisor);

Library Structure

ComponentDescription
ClienteVerifactuMain client class — authentication, factories, API calls
EmisorInvoice issuer model
DestinatarioInvoice recipient model
DesgloseTax breakdown model
TerceroThird-party issuer model
RegistroAltaInvoice registration record
RegistroAnulacionInvoice cancellation record
FacturaRectificadaReference to a corrected invoice
FacturaSustituidaReference to a substituted invoice

Build docs developers (and LLMs) love