# Webhooks

We offer webhook callbacks for clients that want to be updated when a deposit is detected on-chain or finalized.

## Webhook payload examples

{% hint style="info" %}
AquaPay guarantees at-least-once delivery of our webhook messages, and to avoid duplicates, you can utilize txHash and adminApproval as deduplication IDs.
{% endhint %}

{% tabs %}
{% tab title="Unconfirmed" %}
Unconfirmed webhook is disabled by default. You can enable it on AquaPay web portal "Webhooks" page.

```json
{
  "address": "mzczAqqqNqtozbaT7oJEzYML814Wg7d999",
  "adminApproval": "UNCONFIRMED",
  "confirmation": 0,
  "executableQuantity": 0.00002159,
  "fiatReceivable": 1,
  "quantity": 0.00002159,
  "strategy" : "RFQ",
  "sourceAddress": "tb1qx3r63vymgvp0ln5na022zzh7cv6xu3rs94g6ca",
  "subaccount": "deedddff",
  "symbol": "BTC",
  "tradePrice": 46319.1759999501,
  "transactionType": "DEPOSIT",
  "txHash": "14a8cbac6973374573326ab97891c9fe13eec03143e538e1a3e92987140ab04a",
  "txId": "3e06c4eb-b134-4a93-a78f-a979e1d3a803",
  "paymentId": "4618d63b-ea56-4f9f-920a-932faac40c4b",
  "username": "woojchung"
}
```

{% endtab %}

{% tab title="Done" %}

```javascript
{
  "quantity": 0.003223,
  "subaccount": "deedddff",
  "fiatReceivable": 12.347,
  "executableQuantity": 0.003223,
  "txId": "14ea698f-96b6-468d-8b1f-c52a695ee627",
  "paymentId": "4618d63b-ea56-4f9f-920a-932faac40c4b",
  "symbol": "ETH",
  "strategy" : "RFQ",
  "txHash": "0xf62f9fe6c90e85792fef676ddaa711916d9abb6b6b600e3c5b1d4bdcb1a38ec1",
  "txTime": 1632204599177,
  "address": "0xc08377dF1eF026aeb12dcc57D254173CB6b0A1aA",
  "fiatReceived": 12.347,
  "transactionType": "DEPOSIT",
  "tradePrice": 3831.0226,
  "username": "woojchung",
  "adminApproval": "DONE"
}
```

{% endtab %}

{% tab title="Rejected" %}

```json
{
  "quantity": 0.00009989,
  "sourceAddress": "tb1qwmxjsq283elnzsd306c6h3z08fucyhl565a4s2",
  "subaccount": "deedddff",
  "txId": "e09fef5d-6ab4-4da1-bed6-5a7d6416162d",
  "paymentId": "4618d63b-ea56-4f9f-920a-932faac40c4b",
  "symbol": "BTC",
  "strategy" : "RFQ",
  "txHash": "7f9e94c800079ed7ff71da6d02e16885e9ae39cb8c79473649fb00254f20fe1b",
  "txTime": 1649259696838,
  "address": "mtTu1NHfgbWQH2u4iXCfSYnohbQw1w1AJj",
  "transactionType": "DEPOSIT",
  "expired": true,
  "tradePrice": 57045.14521362,
  "username": "woojchung",
  "adminApproval": "REJECTED",
  "reason": "Expired"
}
```

{% endtab %}

{% tab title="Failed" %}

```javascript
{
  "quantity": 0.00009989,
  "sourceAddress": "tb1qwmxjsq283elnzsd306c6h3z08fucyhl565a4s2",
  "strategy": "ACA",
  "subaccount": "test",
  "fiatReceivable": 4.3,
  "txId": "ca03390e-8d72-482b-a95a-946796c46ad8",
  "symbol": "BTC",
  "txHash": "72bf9e87407ade9ba38b7584987de66cba8fbb1e7e9bd1964af138_jdeg6i",
  "address": "mp2HCxb2f69hiGgti5XvWu2Z8yLkoLi6jk",
  "transactionType": "DEPOSIT",
  "confirmation": 0,
  "tradePrice": 43073.6,
  "username": "deposit_test_user_jdeg6i",
  "adminApproval": "FAILED",
  "expired": false,
  "paymentId": "8ac5c3af-f663-4da1-9683-2d160b3e4e43",
  "feeModel": "EXPLICIT"
}
```

{% endtab %}
{% endtabs %}

## Callback parameter values

<table data-header-hidden><thead><tr><th width="172.4">parameter</th><th width="150"></th><th>description</th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>paymentId</td><td><code>string</code></td><td>Bill Id provided by aquapay, can be used for query a bill status or doing conversions</td></tr><tr><td>txId</td><td><code>string</code></td><td>Deposit Id provided by AquaPay</td></tr><tr><td>address</td><td><code>string</code></td><td>Address of the deposit</td></tr><tr><td>sourceAddress</td><td><code>string</code></td><td>Source address of the deposit</td></tr><tr><td>adminApproval</td><td><code>'UNCONFIRMED'|'DONE' | 'REJECTED' | 'FAILED'</code></td><td><p>Status of Transaction. </p><p><strong>UNCONFIRMED:</strong> a deposit is detected and waiting for further confirmation</p><p><strong>DONE:</strong> Successfully deposited and converted</p><p><strong>REJECTED:</strong> Successfully deposited but no conversion occurred<br><strong>FAILED:</strong> a deposit is failed on blockchain</p></td></tr><tr><td>executableQuantity</td><td><code>number</code></td><td>The amount of crypto quantity that can be executed. Not available for <code>"ACA"</code> strategy.</td></tr><tr><td>fiatReceivable</td><td><code>number</code></td><td>The amount of quantity in fiat that is expected. If a user accidentally sends over the value of the quantity accepted, we will never trade above the quantity provided, and thus the fiatReceived will never be higher than the fiatReceivable.</td></tr><tr><td>fiatReceived</td><td><code>number</code></td><td>Amount traded to fiat</td></tr><tr><td>quantity</td><td><code>number</code></td><td>Quantity (in Crypto) deposited</td></tr><tr><td>subaccount</td><td><code>string</code></td><td>Payment service provider's user who initiate the deposit request</td></tr><tr><td>symbol</td><td><code>string</code></td><td>Crypto Symbol</td></tr><tr><td>tradePrice</td><td><code>number</code></td><td>Price of Execution</td></tr><tr><td>transactionType</td><td><code>'DEPOSIT'</code></td><td>Type of transaction. Will always be DEPOSIT</td></tr><tr><td>txHash</td><td><code>string</code></td><td>Blockchain Transaction Hash</td></tr><tr><td>txTime</td><td><code>number</code></td><td>Time of transaction confirmation in blockchain</td></tr><tr><td>username</td><td><code>string</code></td><td>Your username</td></tr><tr><td>expired</td><td><code>boolean</code></td><td>The bill is expired</td></tr><tr><td>strategy</td><td><code>string</code></td><td>The payment strategy of the bill</td></tr><tr><td>reason</td><td><code>string</code></td><td>Human-readable rejected reason for reference only.</td></tr></tbody></table>


---

# 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://docs.aquapay.io/integration-guide/callback-examples.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.
