# Webhook

### Webhook de Notificación al Comercio

**Descripción**: El propósito del webhook es notificar al comerciante sobre la actualización en tiempo real de los estados de los pagos entrantes. Recomendamos interpretar correctamente los tipos de estados para evitar comportamientos no deseados.

**URL del Webhook**: La URL de notificación proporcionada por el comerciante. Esta URL debe ser colocada en tu panel de administración en la configuración del dispositivo. Los webhooks se proporcionan por dispositivo.

**Metodo API**: POST

**Header**: Los siguientes campos están incluidos:

```
○ ‘X-NONCE’: Unix Timestamp.
○ ‘X-SIGNATURE’: hexadecimal(hmac_sha256(merchant_secret_key, nonce + body)).
```

**Importante**: Para verificar que la información del cuerpo es correcta, el comerciante debe crear una firma con la fórmula previamente mostrada y compararla con la X-SIGNATURE recibida en el encabezado. También se recomienda rechazar la información del cuerpo si ha transcurrido un tiempo de 15/20 segundos desde el `Unix Timestamp`.

Datos de salida: JSON con toda la información del pago. Ejemplo:

```
{  
   "fiat_amount": 5.0,
   "status": "AC",
   "crypto_amount": 0.06519511,
   "unconfirmed_amount": 0.770000002,
   "confirmed_amount": 0.0,
   "currency": "DASH",
   "identifier": "cc80e0b5-f779-4094-be65-fcee4b5bd041"
}
```

**X-SIGNATURE** verificación

**Body** ejemplo:

```
{ 
   "fiat_amount": 100.0,
   "status": "AC",
   "crypto_amount": 1.21461894,
   "unconfirmed_amount": 8.0,
   "confirmed_amount": 0.0,
   "currency": "DASH",
   "identifier": "1040095a-737d-41a2-a2e1-d031d19ec8cd"    
}
```

**Nonce**: `"1645634942"`

**Merchant Secret Key**:

`bytes.fromhex("02d4b921007cad413e79731dd02b3267cd43a14d150a0ae6a1c651942122bb62")`

* X-SIGNATURE `hexadecimal(hmac_sha256(merchant_secret_key, nonce + body))`:

`"ff2ac6c50f09916783f1192c35e7f169a14a806e944827b9136bf1406ade8c9d"`

### Respuesta Webhook

En la respuesta del webhook recibirás múltiples parámetros. Los más importantes son:

* `status` (Los mas importantes son  ‘AC’ + safe=True, ‘CO’ and ‘OC’).
* `fiat_amount` (Monto del pago en euros fiat)
* `received_amount` (Será menor que fiat\_amount cuando el  estado es 'OC')


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bitnovo.gitbook.io/pay-es/bitnovo-pay/integraciones/integracion-api/webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
