Webhooks allow your application to receive automatic HTTP POST notifications from VeriFactuAPI whenever an invoice record changes state — for example when it is accepted or rejected by AEAT. Instead of polling the API for updates, you register a publicly accessible endpoint on your server and VeriFactuAPI calls it with the relevant event data.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.
Create a Webhook
CallcreateWebhook() with the URL of your receiving endpoint. The method registers the webhook with VeriFactuAPI and returns the integer ID assigned to it:
The URL may include the
{id} placeholder, which VeriFactuAPI replaces with the relevant record ID when it dispatches the notification. This makes it easy to route incoming events to the correct handler on your server.createWebhook() POSTs to /api/webhook with http_method set to POST. The returned integer ID is what you pass to emisores and invoice records to wire up notifications.
List Registered Webhooks
UselistarWebhooks() to retrieve webhooks previously registered under your account. Call it with no arguments to get all webhooks, or pass an integer ID to fetch a specific one:
Associate a Webhook with an Emisor
To route VeriFactuAPI notifications for a specific emisor to your endpoint, pass thewebhookID when creating the emisor. This sets the default_webhook_id field on the emisor record:
Webhook Inheritance on Invoice Records
When you create aRegistroAlta without explicitly specifying a $webhookID, verifactuPHP automatically inherits the webhook ID from the associated emisor:
nuevoRegistroAlta():

