# Deposit Callbacks

To receive callbacks make sure you registered your URLs on [AkashicPay.com](https://docs.akashicpay.com/callbacks/pages/aSZiTaZkefs55F4pMqmT#akashicpay.com). There are three options, one for pending [deposits](/introduction/terminology.md#deposit), one for confirmed deposits, and one for failed deposits.

* Pending Deposits: Receive callbacks as soon as the (Layer 1) transaction is registered on [L1](/introduction/terminology.md#layer-1) and [L2](/introduction/terminology.md#layer-2), but before it has been confirmed on the L1 network (i.e. before nodes have verified it or enough blocks have been created/mined on top).
* Deposits: Receive callback when the transaction is confirmed (through sufficient blocks/nodes) on Layer 1 [networks](/introduction/terminology.md#network). Transactions that failed to confirm will also be included here. As for L2 transactions, since they are near-instant they will also be included here.
* Failed Deposits: Receive callbacks if the transaction fails to complete on Layer 1, even though it might have been registered/broadcast. In this case, funds should *not* be credited.&#x20;

We recommend always setting the Deposit URL. If you'd like more control and to receive information earlier, also set the URL for pending deposits - but be aware that deposits that show up as pending are not final and may still fail (albeit rarely). (They could be the same URL!)

Note: If the response to the callback has a status code >= 400, the callback is retried up to 10 times with increasing delays up to around 15 minutes since the first attempt.

**If you are managing the balance of users in your system, please note that the amount in the callback does&#x20;*****not*****&#x20;include the** [**AkashicPay Fee**](/introduction/terminology.md#fees-gas) **charged on you. If you would like to credit your user with the actual available funds you should subtract `internalFee.deposit` from the amount.**

> **Note:** When retrying a callback, the request will be sent only to the callback URL that was configured at the time the original callback was created. Any newly added callback URLs, or changes made to existing callback URLs after the initial attempt, will not be used during the retry process.

> **Note**: `l2Txnhash` (the "L2-hash") should always be used as the unique identifier of a transaction. This is a unique transaction-hash for any transaction on [AkashicChain](/introduction/terminology.md#akashicchain). It is present for Confirmed deposits and Pending/Confirmed payouts. This is particularly important for the case of [Layer 2](/introduction/terminology.md#layer-2) transactions, which will not have a Layer 1 hash (`txHash`)

> **Note**: `internalFee` refers to the[ L2 fees](https://docs.akashicscan.com/#layer-2-l2-fees) associated with transactions on AkashicChain. These are *always* in the *same currency* as the transaction itself

> **Note:** Deposit callbacks are *not* sent for Layer 1 deposits with a value less than 1 USD equivalent token.

> **Note:** While we aim for stability and consistency at Akashic, we cannot guarantee that the below object remains unchanged. For example, new features might necessitate additional fields in the callback. We will however aim to not remove existing fields. For convenience, we recommend filtering and handling the callback as per your needs while being open to the possibility of future additions.

### Examples

#### Pending Deposit (L1Transaction)

Note the lack of `l2TxnHash`

{% code overflow="wrap" %}

```json
{
  "initiatedAt": "2024-08-19T10:02:54.000Z", // ISO8601 format
  "fromAddress": "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
  "toAddress": "TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg",
  "coinSymbol": "TRX-SHASTA", // NetworkSymbol
  "status": "Pending", // TransactionStatus. Always "Pending" here of course
  "type": "Deposit", // TransactionType. Always "Deposit" here
  "layer": "L1Transaction", // TransactionLayer. Always L1 for pending
  "amount": "10.000000", 
  "txHash": "28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc", // L1 txHash
  "receiverInfo": {
    "identity": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Identity/L2-address/Akashic address of receiver
  },
  "receiverIdentity": "AS18...", // DEPRECATED. Same as above. Please use receiverInfo.identity 
  "tokenSymbol": "USDT", // Only here if a token-transaction,
  "identifier": "user123",
  // The below only if matching a requested amount
  "depositRequest": {
    "exchangeRate": "7.182",
    "requestedValue": {
      "amount": "1000",
      "currency": "USD"
    }
  }
}

```

{% endcode %}

#### Deposit (L1Transaction)

Refer to "Pending" above. Differences pointed out

*Note that because of the fees, the actual funds under your control are:* `10.0 - 0.1 = 9.9`

{% code overflow="wrap" %}

```json
{
  "initiatedAt": "2024-08-19T10:03:58.649Z",
  "confirmedAt": "2024-08-19T10:05:02.529Z", // Time transaction was safely confirmed
  "fromAddress": "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
  "toAddress": "TQH8ygbS8BAnzSQ9uxR9vXHJYMQVRvbgPg",
  "coinSymbol": "TRX-SHASTA",
  "status": "Confirmed", // "Confirmed" or "Failed"
  "type": "Deposit",
  "layer": "L1Transaction", // Could be "L2Transaction" here
  "amount": "10.000000",
  "internalFee": {
    "deposit": "0.100000" // Akashic-fee, not present if Failed
  },
  "txHash": "28a9880ad2ef3b7be1c40763128ec9630ab74e4749a3c81037c3501e4209bfcc",
  "l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // AkashicChain txHash, only set after confirmation. Not present if Failed
 "receiverInfo": {
    "identity": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Identity/L2-address/Akashic address of receiver
  },
  "receiverIdentity": "AS18...", // DEPRECATED. Same as above. Please use receiverInfo.identity 
  "tokenSymbol": "USDT", // Only here if a token-transaction,
  "identifier": "user123",
  // The below only if matching a requested amount
  "depositRequest": {
    "exchangeRate": "7.182",
    "requestedValue": {
      "amount": "1000",
      "currency": "USD"
    }
  }
}
```

{% endcode %}

#### Deposit (L2Transaction)

If user is sending assets from [AkashicLink](/introduction/terminology.md#akashiclink), it will be executed in [AkashicChain](/introduction/terminology.md#akashicchain), which is our Layer 2 blockchain to reduce the gas fee and cost in Layer 1.&#x20;

<pre class="language-json" data-overflow="wrap"><code class="lang-json"><strong>{
</strong>  "initiatedAt": "2024-08-19T10:03:58.649Z",
  "confirmedAt": "2024-08-19T10:03:58.649Z",
  "fromAddress": "AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764", // Same as senderIdentity
  "toAddress": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Same as receiverIdentity
  "coinSymbol": "TRX-SHASTA",
  "status": "Confirmed", // "Confirmed" or "Failed"
  "layer": "L2Transaction", // Could be "L2Transaction" here
  "amount": "10.000000",
  "internalFee": {
    "deposit": "0.100000" // Akashic-fee, not present if Failed
  },
  "l2TxnHash": "ASe7eb1cb8193787040fcffa02a224a6ced7415ff2205343c0ab661e898e8d6eef", // AkashicChain txHash
  "receiverInfo": {
    "identity": "AS188689e48494c8a452683587138f209d673aada204cb23393140e7f40280e0c5", // Identity/L2-address/Akashic address of receiver
  },
  "receiverIdentity": "AS18...", // DEPRECATED. Same as above. Please use receiverInfo.identity 
  "tokenSymbol": "USDT", // Only here if a token-transaction,
  "identifier": "user123",
 "senderInfo": {
    "identity": "AS3ce733d2af1ee530e0e85bd7de45c59626b28f95ac2d8e83a0685a70aac9b764", // Akashic Address of sender
  },
  "senderIdentity": "AS3c...", // DEPRECATED. Same as above. Please use senderInfo.identity instead
  // The below only if matching a requested amount
  "depositRequest": {
    "exchangeRate": "7.182",
    "requestedValue": {
      "amount": "1000",
      "currency": "USD"
    }
  }
}
</code></pre>


---

# 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.akashicpay.com/callbacks/deposit-callbacks.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.
