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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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:

  1. qr_base64: A ready-to-use base64-encoded QR code image that can be directly embedded in digital or printed invoices
  2. qr_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.


All versions of factuapi-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
saloonphp/pagination-plugin Version ^2.2
saloonphp/saloon Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package factuapi/factuapi-php-sdk contains the following files

Loading the files please wait ...