Skip to Content
v1.5Official documentation for the LX CloudPos API · stable in production

Handling rejections

When Hacienda (Costa Rica’s tax authority) rejects a document, LX CloudPos notifies you by webhook with "ind_estado": "rechazado" and the reason in the mensaje field. Your integration should record it, alert the team, and, depending on the cause, offer the user the option to correct and reissue.

The following handler persists the status locally, alerts Slack, and leaves a comment about what to decide to automate:

async function manejarRechazo(evento) { await db.facturas.update({ where: { clave: evento.clave }, data: { estadoLocal: 'rechazado', mensajeError: evento.mensaje } }); // Notify the team await alertarSlack({ canal: '#alertas-facturacion', mensaje: `Comprobante rechazado: ${evento.clave}\nMotivo: ${evento.mensaje}` }); // If it's due to a customer error (incorrect data), // notify the user to correct it and reissue }

Before processing the event, you must verify the webhook’s HMAC signature and apply deduplication by nonce; otherwise a retry can generate two alerts for the same rejection.