Webhook troubleshooting
”I’m not receiving webhooks”
Check the following:
- The API key has
webhookUrlconfigured (ask the administrator to confirm). - The URL is HTTPS and resolves to a valid public IP (not RFC1918 or link-local).
- The endpoint responds with
2xxin under 10 s. - The document was issued via the API: documents issued from the web POS do not fire webhooks.
- Hacienda has already responded. If the document is
procesando, there is nothing to notify yet.
”I’m getting 401 or an invalid signature”
Check the following:
- You are using the same
webhookSecretthat was generated when the key was created or rotated. - You read the raw body before parsing it (without re-serializing the JSON).
- The comparison is performed with a timing-safe function (
timingSafeEqual,hmac.compare_digest,hash_equals, etc.). - No spaces, BOM, or newlines are added to or removed from the body before computing the HMAC.
”I’m receiving the same event multiple times”
This is expected behavior during a retry. You must implement deduplication by nonce: the nonce changes on each attempt, so it works as the unique “delivery” key.
”I received the webhook, but the document doesn’t appear in GET /facturas/{clave}”
This is unlikely, but it can happen due to a race condition. Retry the GET with exponential backoff. If the situation persists for more than a minute, open a support ticket.