Download the PHP package factuapi/factuapi-php-sdk without Composer
On this page you can find all versions of the php package factuapi/factuapi-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package factuapi-php-sdk
Factuapi PHP SDK
A PHP SDK for interacting with the Factuapi API. This SDK allows you to easily create, manage, and process invoices through the Factuapi platform, including support for Spanish invoicing requirements like equivalence surcharge and VIES VAT numbers.
Installation
Usage
To authenticate, you'll need an API token. You can create one in the API tokens screen at Factuapi.
Create invoice
You can create invoices using the invoices()->create() method. The method requires an Invoice object with all the necessary information.
Equivalence surcharge
For invoices that require equivalence surcharge (recargo de equivalencia), you can specify the equivalenceSurchargeType and equivalenceSurchargePrice in the invoice items:
IVA exempt invoice
For invoices that are exempt from IVA (Spanish VAT), you need to specify an exemption reason using the ExemptionReason enum. Set the taxRate to 0, include the appropriate exemptionReason value, and ensure taxPrice is also 0. The available exemption reasons correspond to specific articles in Spanish tax law (Article 20, 21, 22, 23/24, 25, or Other).
VIES VAT number
For intra-community invoices with VIES VAT numbers, use the OtherRecipient class with the appropriate country code and ID type:
Create credit note
To create a credit note (rectificativa), use the invoices()->create() method with invoiceType: "CreditNote" and include the creditNote and relatedInvoices properties:
Correct invoice
To correct an invoice without fiscal impact (e.g., changing recipient details but not totals), use the invoices()->correct() method:
For corrections with fiscal impact (changing amounts), you should create a credit note (rectificativa) instead.
Cancel invoice
Only use invoice cancellation when the invoice was generated by error (e.g., during testing or for a service that was not ultimately contracted). Never use cancellation to modify an invoice - in those cases, you should create a credit note (rectificativa) or correction instead.
To cancel an invoice, use the invoices()->cancel() method with the invoice number:
This will mark the invoice as cancelled in the system.
Verifactu Integration
Verifactu is a service that facilitates compliance with Spanish tax authority (AEAT) anti-fraud requirements. By integrating with Verifactu, your invoices are automatically verified and secured with cryptographic hashes, ensuring regulatory compliance with anti-fraud measures and providing official verification.
Enabling Verifactu Processing
To submit an invoice to the Verifactu service, add "verifactu" to the process array parameter when creating,
correcting, or canceling an invoice:
Understanding the Response
When an invoice is processed through Verifactu, the response will include verification data with the following components:
Processing Status
The initial status will always be "pending" as Verifactu processes submissions in batches. Your invoice will typically
be processed within one minute of submission. You can check the final status by retrieving the invoice details later.
QR Code Implementation
The response includes two options for implementing the required verification QR code on your invoices:
qr_base64: A ready-to-use base64-encoded QR code image that can be directly embedded in digital or printed invoicesqr_url: The verification URL that can be used to generate your own QR code if you prefer to use a custom QR code generator
Including this QR code on your invoices is mandatory for compliance in Spain.
License
The MIT License (MIT). Please see License File for more information.