> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cryptoprocessing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposit callbacks

## Processing deposit callbacks

Deposit callbacks are sent whenever funds are received at an address created via the [/addresses/take](/api-reference/endpoints/addresses-take) endpoint.

Use the `foreign_id` field to identify which customer made the deposit. This value is the same as the `foreign_id` you provided when calling `/addresses/take`.

Handle callback statuses as follows:

* `"status": "confirmed"` — the deposit has been fully confirmed, and it is safe to perform business actions such as crediting the customer’s balance in your system.
* `"status": "not_confirmed"` — the deposit has been detected but is still being processed. In this case, we recommend creating the transaction on your side with a `pending` or `processing` status and informing the customer that the deposit is still being confirmed.

Amount fields included in the callback:

* `currency_sent.amount` — the amount sent by the customer in the deposit currency
* `currency_received.amount` — the amount received after processing or conversion
* `currency_received.amount_minus_fee` — the amount credited to your merchant balance after fees

## Deposit callback payload examples

<Tabs>
  <Tab title="Confirmed">
    Sent when a deposit has been successfully confirmed and can be treated as final on your side. At this stage, it is safe to perform business actions such as crediting the customer's balance.

    ```json highlight={9,18-19,43} theme={null}
    {
        "id": 1,
        "end_user_reference": "12345",
        "type": "deposit",
        "crypto_address": {
            "id": 1,
            "currency": "BTC",
            "address": "39mFf3X46YzUtfdwVQpYXPCMydc74ccbAZ",
            "foreign_id": "12345",
            "tag": null
        },
        "currency_sent": {
            "currency": "BTC",
            "amount": "6.53157512"
        },
        "currency_received": {
            "currency": "BTC",
            "amount": "6.53157512",
            "amount_minus_fee": "6.5119800"
        },
        "transactions": [
            {
                "id": 1,
                "currency": "BTC",
                "transaction_type": "blockchain",
                "type": "deposit",
                "address": "39mFf3X46YzUtfdwVQpYXPCMydc74ccbAZ",
                "tag": null,
                "amount": "6.53157512",
                "txid": "3950ad8149421a850d01dff88f024810e363ac18c9e8dd9bc0b9116e7937ad93",
                "riskscore": "0.5",
                "confirmations": 3
            }
        ],
        "fees": [
            {
                "type": "deposit",
                "currency": "BTC",
                "amount": "0.01959472"
            }
        ],
        "error": "",
        "status": "confirmed"
    }
    ```
  </Tab>

  <Tab title="Confirmed (with conversion)">
    Sent when funds are received at an address configured with automatic conversion. In this case, the deposited amount is received in the address currency, and then converted into the `convert_to` currency before being credited to your balance.

    ```json highlight={7-8,11,17-21,53} theme={null}
    {
        "id": 2686510,
        "end_user_reference": "12345",
        "type": "deposit_exchange",
        "crypto_address": {
            "id": 382270,
            "currency": "BTC",
            "convert_to": "EUR",
            "address": "39mFf3X46YzUtfdwVQpYXPCMydc74ccbAZ",
            "tag": null,
            "foreign_id": "12345"
        },
        "currency_sent": {
            "currency": "BTC",
            "amount": "0.01000000"
        },
        "currency_received": {
            "currency": "EUR",
            "amount": "84.17070222",
            "amount_minus_fee": "79.96216711"
        },
        "transactions": [
            {
                "id": 714576,
                "currency": "BTC",
                "transaction_type": "blockchain",
                "type": "deposit",
                "address": "39mFf3X46YzUtfdwVQpYXPCMydc74ccbAZ",
                "tag": null,
                "amount": "0.01000000",
                "txid": "3a491da90a1ce5a318d0aeff6867ab98a03219abae29ed68d702291703c3538b",
                "riskscore": "0.42",
                "confirmations": "1"
            },
            {
                "id": 714577,
                "currency": "BTC",
                "currency_to": "EUR",
                "transaction_type": "exchange",
                "type": "exchange",
                "amount": "0.01000000",
                "amount_to": "84.17070222"
            }
        ],
        "fees": [
            {
                "type": "exchange",
                "currency": "EUR",
                "amount": "4.20853511"
            }
        ],
        "error": "",
        "status": "confirmed"
    }
    ```
  </Tab>

  <Tab title="Cross-currency deposit">
    Sent when a user deposits a currency different from the one originally assigned to the address. In this case, the callback includes `expected_currency`, and `crypto_address.cross_currency` is set to `true`.

    ```json highlight={5,11} theme={null}
    {
        "id": 2686510,
        "end_user_reference": "12345",
        "type": "deposit",
        "expected_currency": "USDC",
        "crypto_address": {
            "id": 382270,
            "currency": "ETH",
            "address": "0xd61180ff0cf74dc3ee8e264751f18c47060729b9",
            "tag": null,
            "cross_currency": true, 
            "foreign_id": "12345"
        },
        "currency_sent": {
            "currency": "ETH",
            "amount": "0.01000000"
        },
        "currency_received": {
            "currency": "ETH",
            "amount": "0.01000000",
            "amount_minus_fee": "0.00900000"
        },
        "transactions": [
            {
                "id": 714576,
                "currency": "ETH", 
                "transaction_type": "blockchain",
                "type": "deposit",
                "address": "0xd61180ff0cf74dc3ee8e264751f18c47060729b9",
                "tag": null,
                "amount": "0.01000000",
                "txid": "3a491da90a1ce5a318d0aeff6867ab98a03219abae29ed68d702291703c3538b",
                "riskscore": "0.72",
                "confirmations": "9"
            },
        
        ],
        "fees": [
            {
                "type": "transfer",
                "currency": "ETH",
                "amount": "0.00037336"
            },
           
        ],
        "error": "",
        "status": "confirmed"
        }
    ```
  </Tab>

  <Tab title="Processing">
    Sent when the transaction has been detected but is still being processed. You can create the deposit on your side with a `pending` or `processing` status, but should wait for a `confirmed` callback before treating it as final.

    ```json highlight={9,17-18,36} theme={null}
    {
      "id": 132506113,
      "end_user_reference": "12345",
      "type": "deposit",
      "crypto_address": {
        "id": 3776973,
        "currency": "ETH",
        "address": "0x071B2E45e2CD08011555755b93d5C76D2E62C4Cd",
        "tag": null,
        "foreign_id": "11"
      },
      "currency_sent": {
        "currency": "ETH",
        "amount": "0.01000000"
      },
      "currency_received": {
        "currency": "ETH",
        "amount": "0.01000000",
        "amount_minus_fee": "0.01000000"
      },
      "transactions": [
        {
          "id": 3745588,
          "currency": "ETH",
          "transaction_type": "blockchain",
          "type": "deposit",
          "address": "0x071B2E45e2CD08011555755b93d5C76D2E62C4Cd",
          "tag": null,
          "amount": "0.01000000",
          "txid": "0x4c72ffcb2dfcd0b21c4f19c094558865af465abdfa04a2b8c33ee569afa4ef8d",
          "riskscore": null,
          "confirmations": "1"
        }
      ],
      "fees": [],
      "error": "",
      "status": "not_confirmed"
    }
    ```
  </Tab>

  <Tab title="Below minimum amount">
    Sent when the deposited amount is lower than the minimum allowed for that currency. Such deposits are not credited, and no fees are charged.

    ```json highlight={10,26-27} theme={null}
    {
        "id": 2686563,
        "end_user_reference": "12345",
        "type": "deposit",
        "crypto_address": {
            "id": 381738,
            "currency": "ETH",
            "address": "0xd61180ff0cf74dc3ee8e264751f18c47060729b9",
            "tag": null,
            "foreign_id": "12345"
        },
        "transactions": [
            {
                "id": 714657,
                "currency": "ETH",
                "transaction_type": "blockchain",
                "type": "deposit",
                "address": "0xd61180ff0cf74dc3ee8e264751f18c47060729b9",
                "tag": null,
                "amount": "0.00000001",
                "txid": "0x6b353da88a8ba2df4926c1ccc58991f484a683ba57ec3dde70e812b5c8c7fa1d",
                "confirmations": "9"
            }
        ],
        "fees": [],
        "error": "Transaction amount less than minimum deposit",
        "status": "cancelled"
    }
    ```
  </Tab>

  <Tab title="Cancelled (double spend)">
    Sent when a detected deposit is cancelled because of a double-spend event. Since the transaction is not considered valid, you should not credit the customer's balance.

    ```json highlight={10,27-28} theme={null}
    {
      "id": 100,
      "end_user_reference": "12345",
      "type": "deposit",
      "crypto_address": {
        "id": 123,
        "currency": "BTC",
        "address": "tb1qhaj2ruldumppj49ystync0um6239qsjj44s67e",
        "tag": null,
        "foreign_id": "12345"
      },
      "transactions": [
        {
          "id": 999,
          "currency": "BTC",
          "transaction_type": "blockchain",
          "type": "deposit",
          "address": "tb1qhaj2ruldumppj49ystync0um6239qsjj44s67e",
          "tag": null,
          "amount": "0.002",
          "txid": "5d52f01510df872b3115e6f88e9f58a1d15603498a58924d2ea2c1a8e34751c7",
          "riskscore": "0.01",
          "confirmations": "0"
        }
      ],
      "fees": [],
      "error": "Double spend",
      "status": "cancelled"
    }
    ```
  </Tab>
</Tabs>

## Callbacks for instant confirmations

For deposits, our system supports instant confirmations. This means some deposits can be confirmed in our system before they are confirmed on the blockchain. In these cases, the system immediately sends a callback with the `confirmed` status. By confirming the transaction early, we assume the risk associated with accepting the funds before on-chain confirmation. No action is required on your side.

In other cases, you will first receive a callback with the `not_confirmed` status. This means we have detected the transaction in the mempool, but we are not yet ready to guarantee that it will be completed. In this case, you can create the transaction on your side and assign it the `pending` status. Then wait for the second callback, in which the `status` parameter will change to `confirmed`.

## Additional deposit callbacks

You can choose whether to receive callbacks for the cases below. By default, these callbacks are enabled:

* deposits below the minimum allowed amount
* deposits received in a currency different from the currency assigned to the crypto address

To configure additional callbacks, follow these steps:

1. In the merchant dashboard, go to **Settings** and open the **Callbacks** tab.
2. Under **Additional callbacks**, click **Manage**.
   <Frame>
     <img src="https://mintcdn.com/coinspaid/9v5zUott1Mn47MFs/images/additional_callbacks.png?fit=max&auto=format&n=9v5zUott1Mn47MFs&q=85&s=51a2495a7fbc2eae4b10aaa5fac43f1b" alt="Additional Callbacks" width="2318" height="552" data-path="images/additional_callbacks.png" />
   </Frame>
3. Enable or disable one or both of the following options, then click **Save changes**.
