# Deposit methods

{% hint style="danger" %}
This API version is deprecated and will no longer be supported after December 1, 2025. Refer to [API v3](https://docs.b2binpay.com/api-guide/deposit-methods) for updated descriptions.
{% endhint %}

## Deposit object

<table><thead><tr><th width="232">Name</th><th width="106">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>string</td><td><p>The unique system identifier of a deposit.</p><p>This value is generated automatically at the moment of deposit creation and can’t be changed.</p></td></tr><tr><td><code>status</code></td><td>number</td><td><p>The current deposit status. Possible values:</p><ul><li><code>2</code> — Created — the deposit has just been created or hasn’t yet been paid in full (for deposits with indicated amounts). The deposits to Enterprise wallets are always assigned the <em>Created</em> status.</li><li><code>3</code> — Paid — the deposit with the indicated amount was paid in full.</li><li><code>4</code> — Canceled — the deposit was canceled by a user or expired with no payments received. A deposit in any status can be canceled by a user.</li><li><p><code>5</code> — Unresolved — the deposit requires actions from the user. This status is possible in the following cases:</p><ul><li>If the amount of an incoming transfer is greater than the deposit amount.</li><li>If a payment is received after the specified expiration date.</li><li>If a payment is received for a deposit assigned the <em>Paid</em> or <em>Canceled</em> status.</li></ul></li></ul></td></tr><tr><td><code>is_active</code></td><td>boolean</td><td><p><em>Applicable for the Algorand blockchain only.</em></p><p>If <code>true</code>code>, the address is activated.</p><p>In Algorand, any deposit address requires activation, that is sending 0.1–0.2 ALGO to the address. Until the address is activated, the field value is set to <code>false</code>, funds can't be sent to the address. In B2BINPAY, the activation process is automated, the activation transfer has a type with the index 49. After the address is activated, the field value changes to <code>true</code>and a callback is sent (if the callback URL was specified in the deposit settings), containing the deposit address.</p><p>Mind that:</p><ul><li>Address activation takes some time, although it usually happens quickly.</li><li>The <code>address</code> field will remain empty until the deposit address is activated.</li><li>Creating a deposit address costs from 0.1 (for coins) to 0.2 (for tokens) ALGO.</li></ul><p>For other blockchains the value is always <code>true</code>and insignificant.</p></td></tr><tr><td><code>address</code></td><td>string or null</td><td><p>The deposit address.</p><p>For deposits to Merchant wallets, if the payment currency wasn’t specified, the value is <code>null</code> until a payer selects the payment currency. After that, this field is filled in with the address generated depending on the payment currency selected by the payer and can’t be changed.</p><p>For the Algorand blockchain, the value is <code>null</code> until the deposit address is activated. Refer to <code>is_active</code> for details.</p></td></tr><tr><td><code>address_type</code></td><td>string</td><td><p>For payments in BTC, LTC, BCH, XRP: the address type. Refer to <a href="../references/address-types">Address types</a> for supported values.</p><p>For other payments, the value is an empty string.</p></td></tr><tr><td><code>label</code></td><td>string</td><td><p>The tag or name assigned to a deposit for easier locating it in the system.</p><p>This value is set when creating a deposit and can be changed anytime.</p></td></tr><tr><td><code>tracking_id</code></td><td>string</td><td><p>The user-provided identifier assigned to a deposit for easier locating related payments in external systems.</p><p>This value is set when creating a deposit and can be changed anytime.</p></td></tr><tr><td><code>confirmations_needed</code></td><td>number or null</td><td><p>The number of confirmations needed to trigger an additional callback.</p><p>If this field isn’t <code>null</code>, two callbacks are sent: upon receiving the number of confirmations specified here and upon receiving the number of confirmations specified in the system settings. The corresponding transaction is assigned the <em>Confirmed</em> status as soon as the number of confirmations specified in this field received.</p></td></tr><tr><td><code>time_limit</code></td><td>number or null</td><td><p><em>Applicable for deposits to Merchant wallets only.</em></p><p>The lifetime of a deposit, in milliseconds, in the range from <code>59</code> to <code>2147483647</code>.</p></td></tr><tr><td><code>callback</code></td><td>string</td><td>The URL for callback notifications on new payments.</td></tr><tr><td><code>inaccuracy</code></td><td>string</td><td><p><em>Applicable for deposits to Merchant wallets with indicated amounts.</em></p><p>The payment delta, in the wallet currency.</p><p>The delta can be useful to address possible rate changes. For example, you create a deposit for 100 USDT with the expiration time of 10 minutes without specifying the payment currency. This means that the payer can pay in any currency within 10 minutes. But the rate of the currency pair may change within the specified time. In order to minimize your risks, you can set the delta value, for example of 5 USDT, which means that you expect payment from 95 USDT to 105 USDT (depending on the rate) within 10 minutes.</p><p>The delta can be also useful when the payment currency is the same as the wallet currency. For example, if you create a deposit with the indicated amount of 0.1 BTC, and the payer sends 0.1 BTC minus the commission, you won’t receive the full deposit amount. As a result, the deposit can’t be transferred to the <em>Paid</em> status. To avoid such situations, enter the delta value.</p><p>Mind that the delta must be less than the <code>target_amount_requested</code> value.</p></td></tr><tr><td><code>target_amount_requested</code></td><td>string or null</td><td><p><em>Applicable for deposits to Merchant wallets only.</em></p><p>The requested deposit amount, in the wallet currency.</p></td></tr><tr><td><code>rate_requested</code></td><td>string or null</td><td><p>If the payment currency differs from the wallet currency, the value is the exchange rate of the payment currency to the wallet currency; otherwise, the value is <code>1</code>.</p><p>For Merchant wallets, if the payment currency wasn’t specified, the value is <code>null</code> until a payer selects the payment currency. After that, this field is filled in with the current exchange rate.</p></td></tr><tr><td><code>rate_expired_at</code></td><td>string</td><td>The date and time of rate expiration.</td></tr><tr><td><code>invoice_updated_at</code></td><td>string or null</td><td><p><em>Applicable for deposits to Merchant wallets only.</em></p><p>For deposits with the expiration time specified: the date and time when the time limit was set or last updated. For other deposits the value is <code>null</code>.</p></td></tr><tr><td><code>payment_page</code></td><td>string</td><td>The URL of a payment page.</td></tr><tr><td><code>target_paid</code></td><td>string</td><td>The total amount of funds that have already been received to the deposit address, in the wallet currency.</td></tr><tr><td><code>source_amount_requested</code></td><td>string</td><td><p><em>Applicable for deposits to Merchant wallets only.</em></p><p>The deposit amount, in the wallet currency. If the deposit currency is the same as the wallet currency, this value is calculated as <code>target_amount_requested × 1</code> and then rounded up to the precision of the wallet currency (for example, to 8 digits after the decimal separator for BTC).</p></td></tr><tr><td><code>target_amount_requested</code></td><td>string</td><td><p><em>Applicable for deposits to Merchant wallets only, when the payment currency is selected and differs from the wallet currency.</em></p><p>The requested deposit amount, in the payment currency.</p></td></tr><tr><td><code>target_paid_pending</code></td><td>string</td><td>The amount of funds that have been received to the deposit address, but not yet credited, in the wallet currency.</td></tr><tr><td><code>assets</code></td><td>object</td><td><p>The amounts of incoming transfers in different currencies.</p><p>The alphabetic code of a currency is used as a key, the aggregated amounts are values.</p></td></tr><tr><td><code>destination</code></td><td>object or null</td><td><p>The deposit address.</p><p>For deposits to Merchant wallets, if the payment currency wasn’t specified, the value is <code>null</code> until a payer selects the payment currency. After that, this field is filled in with the address generated depending on the payment currency selected by the payer and can’t be changed.</p><p>For more information, refer to <a data-mention href="../api-overview#destination-object">#destination-object</a></p></td></tr><tr><td><code>payment_page_redirect_url</code></td><td>string</td><td>The link that is displayed as a button on the payment page.</td></tr><tr><td><code>payment_page_button_text</code></td><td>string</td><td>The custom name of a button displayed on the payment page.</td></tr><tr><td><code>currency</code></td><td>object</td><td><p>The payment currency.</p><p>The object contains the string <code>id</code> field matching the currency ISO code (refer to <a href="../references/currency-codes">Currency codes</a> for possible values). For Merchant wallets, if the payment currency wasn’t specified, <code>currency.data</code> is <code>null</code>.</p></td></tr><tr><td><code>wallet</code></td><td>object</td><td><p>The wallet to which the deposit was made.</p><p>The object contains the string <code>id</code> field matching the wallet system identifier.</p></td></tr></tbody></table>

#### Deposit object example

{% code overflow="wrap" %}

```json
{
  "type": "deposit",
  "id": "2205",
  "attributes": {
    "status": 2,
    "address": "2NFSVSgbXK7mipDFfuVrLvVJJ9HEgyPNXqu",
    "address_type": "p2sh-segwit",
    "label": "My Deposit",
    "tracking_id": "2244",
    "confirmations_needed": null,
    "time_limit": null,
    "callback_url": "https://my.client.url/cb/",
    "inaccuracy": "0.00000000",
    "target_amount_requested": null,
    "rate_requested": "1.00000000",
    "rate_expired_at": "2024-02-06T16:39:06.507593Z",
    "invoice_updated_at": null,
    "payment_page": "https://pay-sandbox.com/en/a08c7567-956c-4922-b80b-6e515718a9a4/pay",
    "target_paid": "0.00000000",
    "source_amount_requested": "0.00000000",
    "target_paid_pending": "0.00000000",
    "assets": {},
    "destination": {
      "address_type": "p2sh-segwit",
      "address": "2NFSVSgbXK7mipDFfuVrLvVJJ9HEgyPNXqu"
    },
    "payment_page_redirect_url": "https://my.crm.com",
    "payment_page_button_text": "Back to CRM"
  },
  "relationships": {
    "currency": {
      "data": {
        "type": "currency",
        "id": "1000"
      }
    },
    "wallet": {
      "data": {
        "type": "wallet",
        "id": "448"
      }
    }
  }
}
```

{% endcode %}

***

## Get deposit

### Request

<mark style="color:green;">`GET`</mark> `[base]/deposit/`<mark style="color:blue;">`{id}`</mark>

<table><thead><tr><th width="135">Name</th><th width="106">Type</th><th width="100">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>string</td><td>No</td><td>The unique system identifier of a deposit.</td></tr></tbody></table>

Filtering by object parameters can be applied according to the [JSON API Specification](https://jsonapi.org/format/#query-parameters-families).

#### Request example

{% tabs %}
{% tab title="cURL" %}

```sh
curl --request GET \
--url [base]/deposit/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = '[base]/deposit/'

headers = {
  'Authorization': 'Bearer <token>',
  'Content-Type': 'application/vnd.api+json',
}

requests.get(url, headers=headers)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new GuzzleHttp\Client();
try {
  $res = $client->get('[base]/deposit/', [
    'headers' => [
      'Authorization' => 'Bearer <token>',
      'Content-Type' => 'application/vnd.api+json',
    ],
  ]);
echo $res->getBody();
} catch (RequestException $e) {}
```

{% endtab %}
{% endtabs %}

### Response

In case of success, the response body contains a [deposit object](#deposit-object) or an array of objects (if the `id` wasn’t specified).

The wallets list is paginated and the default page size is 10. You can adjust pagination according to the [JSON API Specification](https://jsonapi.org/format/#query-parameters-families).

#### Response codes

<table><thead><tr><th width="134">HTTP code</th><th width="274">Application code</th><th width="170">Description</th><th>Suggested action</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>200</code></mark></td><td>—</td><td>The request succeeded.</td><td>—</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>5001: You can not view deposit</td><td>You don’t have permissions to view the deposit.</td><td>—</td></tr><tr><td><mark style="color:red;"><code>401</code></mark></td><td>2007: No active account found with the given credentials</td><td>Incorrect credentials.</td><td>Send correct credentials.</td></tr><tr><td><mark style="color:red;"><code>404</code></mark></td><td>404: Not found</td><td>The deposit with the given <code>id</code> wasn’t found.</td><td>Send a correct <code>id</code>.</td></tr><tr><td><mark style="color:red;"><code>500</code></mark></td><td>—</td><td>Internal server error.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>502</code></mark></td><td>—</td><td>Bad gateway.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>503</code></mark></td><td>—</td><td>Service unavailable.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>504</code></mark></td><td>—</td><td>Gateway timeout.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>5xx</code></mark></td><td>—</td><td>Other server errors.</td><td>Try again later.</td></tr></tbody></table>

***

## Create deposit

Before creating a deposit, you can retrieve parameters of the fields you need to fill in by calling the [Deposit options](#deposit-options) method.

### Request

<mark style="color:blue;">`POST`</mark> `[base]/deposit/`

<table><thead><tr><th width="179">Name</th><th width="112">Type</th><th width="100">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>label</code></td><td>string</td><td>No</td><td><p>The tag or name assigned to a deposit for easier locating it in the system.</p><p>The maximum string length is 32 characters.</p></td></tr><tr><td><code>tracking_id</code></td><td>string</td><td>No</td><td><p>The user-provided identifier assigned to a deposit for easier locating related payments in external systems.</p><p>The maximum string length is 128 characters.</p></td></tr><tr><td><code>confirmations_needed</code></td><td>number</td><td>No</td><td><p>The number of confirmations needed to trigger an additional callback, in the range from <code>0</code> to <code>100</code>.</p><p>Refer to <a href="#deposit-callback">Deposit callback</a> for more details.</p></td></tr><tr><td><code>callback_url</code></td><td>string</td><td>No</td><td><p>The URL for callback notifications on new payments.</p><p>The maximum string length is 256 characters.</p><p>Refer to <a href="#deposit-callback">Deposit callback</a> for more details.</p></td></tr><tr><td><code>payment_page_redirect_url</code></td><td>string</td><td>The link that is displayed as a button on the payment page.</td><td></td></tr><tr><td><code>payment_page_button_text</code></td><td>string</td><td>The custom name of a button displayed on the payment page.</td><td></td></tr><tr><td><code>id</code></td><td>string</td><td>Yes</td><td>The unique system identifier of a wallet to which deposit-related payments are made.</td></tr></tbody></table>

#### Request example

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request POST \
--url [base]/deposit/ \
--header 'Authorization: Bearer <token>.' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
  "data": {
    "type": "deposit",
    "attributes": {
      "label": "My new deposit",
      "tracking_id": "d-abcd",
      "confirmations_needed": 2,
      "callback_url": "https://my.client.com/cb/",
      "payment_page_redirect_url": "https://my.crm.com",
      "payment_page_button_text": "Back to CRM"
    },
    "relationships": {
      "wallet": {
        "data": {
          "type": "wallet",
          "id": "1"
        }
      }
    }
  }
}'
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

url = '[base]/deposit/'

headers = {
  'Authorization': '<token>',
  'Content-Type': 'application/vnd.api+json',
}

data = {
  'data': {
    'type': 'deposit',
    'attributes': {
      'label': 'My new deposit',
      'tracking_id': 'd-abcd',
      'confirmations_needed': 2,
      'callback_url': 'https://my.client.com/cb/',
      'payment_page_redirect_url': 'https://my.crm.com',
      'payment_page_button_text': 'Back to CRM'
    },
    'relationships': {
      'wallet': {
        'data': {
          'type': 'wallet',
          'id': '1',
        }
      }
    }
  }
}

requests.post(url, headers=headers, json=data)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code overflow="wrap" %}

```php
<?php

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new GuzzleHttp\Client();
try {
  $res = $client->post('[base]/deposit/', [
    'json' => [
      'data' => [
        'type' => 'deposit',
        'attributes' => [
          'label' => 'My new deposit',
          'tracking_id' => 'd-abcd',
          'confirmations_needed' => 2,
          'callback_url' => 'https://my.client.com/cb/',
          'payment_page_redirect_url': 'https://my.crm.com',
          'payment_page_button_text': 'Back to CRM'
        ],
        'relationships' => [
          'wallet' => [
            'data' => [
              'type' => 'wallet',
              'id' => '1',
            ],
          ],
        ],
      ],
    ],
    'headers' => [
      'Authorization' => 'Bearer <token>',
      'Content-Type' => 'application/vnd.api+json',
    ],
  ]);
  echo $res->getBody();
} catch (RequestException $e) {}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Response

In case of success, the response body contains a newly created [deposit object](#deposit-object).

#### Response codes

<table><thead><tr><th width="134">HTTP code</th><th width="166">Application code</th><th width="236">Description</th><th>Suggested action</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>201</code></mark></td><td>—</td><td>The request succeeded.</td><td>—</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>1007</td><td>An invalid value was specified for a field.</td><td>Send valid values.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>3008</td><td>The wallet is inactive or is being registered in the system.</td><td>Activate the wallet or wait until the process of wallet registration in the system is finished and try again.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>3021</td><td>A wallet activation transfer is required.</td><td>Make a transfer to activate the wallet.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>5005</td><td>The deposit address can’t be generated due to technical issues.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>5006</td><td>The deposit rates can’t be obtained due to technical issues.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>5007</td><td>The currency value is required if the address type is specified.</td><td>Specify the currency value.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>6002</td><td>The selected currency is disabled.</td><td>Select an active currency.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>6015</td><td>The currency is unavailable for all clients or for a specific client.</td><td>Select an available currency.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>6017</td><td>A user is trying to make a transaction with a custom token that wasn’t paid for.</td><td>Make a payment for a custom token and proceed with the transaction.</td></tr><tr><td><mark style="color:red;"><code>400</code></mark></td><td>—</td><td>Invalid data (serializer errors).</td><td>Send valid data.</td></tr><tr><td><mark style="color:red;"><code>401</code></mark></td><td>2007</td><td>No active account with the given credentials is found.</td><td>Send correct credentials or update access tokens.</td></tr><tr><td><mark style="color:red;"><code>429</code></mark></td><td>—</td><td>The request was throttled.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>500</code></mark></td><td>—</td><td>Internal server error.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>502</code></mark></td><td>—</td><td>Bad gateway.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>503</code></mark></td><td>—</td><td>Service unavailable.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>504</code></mark></td><td>—</td><td>Gateway timeout.</td><td>Try again later.</td></tr><tr><td><mark style="color:red;"><code>5xx</code></mark></td><td>—</td><td>Other server errors.</td><td>Try again later.</td></tr></tbody></table>

***

## Deposit callback

A callback is a notification sent to a user’s callback URL when a new deposit-related transaction occurs on the blockchain. To learn more, refer to [Callback](https://docs.b2binpay.com/references/key-terms#callback).

### Callback processing

The callback is sent to your server if the deposit request body includes a valid callback URL. The callback is sent as a <mark style="color:blue;">`POST`</mark>-request, which contains useful JSON payload.

After processing the payload, your server should respond with the HTTP <mark style="color:green;">`200`</mark> response code without a body.

If your server is temporarily unavailable or the status of the response is different from <mark style="color:green;">`200`</mark>, the system will resend the callback several times with the increasing delay time. The number of re-sendings is limited.

If the manual resending is required, you can do it on the **Wallet management** > **Callbacks** page in the Web UI.

### Callback verification

To verify that the callback was sent by B2BINPAY, generate an HMAC-signature using `sha256` as algorithm: `sha256` hash of the concatenation of your login and password as a key, and the concatenation of the `transfer.status`, `transfer.amount`, `deposit.tracking_id`, `meta.time` fields as message. Refer to the example below for a callback verification example.

<details>

<summary>Callback verification example</summary>

{% code overflow="wrap" %}

```php
<?php

# set API user login and password
$login = 'Your API key';
$password = 'Your API secret';

# parse callback data
$callback_payload = json_decode (
  '{
    "data": {
      "type": "deposit",
      "id": "11203",
      "attributes": {
        "address": "0xcb959a408cbfbe64116a2dadc20188c290226fae",
        "created_at": "2022-07-15T16:51:52.702456Z",
        "tracking_id": "",
        "target_paid": "0.300000000000000000",
        "destination": {
          "address_type": null,
          "address": "0xcb959a408cbfbe64116a2dadc20188c290226fae"
        }
      },
      "relationships": {
        "currency": {
          "data": {
            "type": "currency",
            "id": "1002"
          }
        },
        "wallet": {
          "data": {
            "type": "wallet",
            "id": "318"
          }
        },
        "transfer": {
          "data": {
            "type": "transfer",
            "id": "17618"
          }
        }
      }
    },
    "included": [
      {
        "type": "currency",
        "id": "1002",
        "attributes": {
          "iso": 1002,
          "name": "Ethereum",
          "alpha": "ETH",
          "alias": null,
          "exp": 18,
          "confirmation_blocks": 3,
          "minimal_transfer_amount": "0.000000000000000000",
          "block_delay": 30
        }
      },
      {
        "type": "transfer",
        "id": "17618",
        "attributes": {
          "op_id": 11203,
          "op_type": 1,
          "amount": "0.300000000000000000",
          "commission": "0.001200000000000000",
          "fee": "0.000000000000000000",
          "txid": "0xa09cb1de38b9b21712ff18d08d6a625cc80ec41c9e64586095d4c46449a9eb51",
          "status": 2,
          "user_message": null,
          "created_at": "2022-07-15T16:53:04.098536Z",
          "updated_at": "2022-07-15T16:54:39.903843Z",
          "confirmations": 8,
          "risk": 0,
          "risk_status": 4,
          "amount_cleared": "0.298800000000000000"
        },
        "relationships": {
          "currency": {
            "data": {
              "type": "currency",
              "id": "1002"
            }
          }
        }
      }
    ],
    "meta": {
      "time": "2022-07-15T16:54:39.966327+00:00",
      "sign": "1377e7a9eb3d62f7708285cd148711c62f50e53d8046e4d412a18ae9a575da85"
    }
  }',
  true
);

$callback_sign = $callback_payload['meta']['sign'];
$callback_time = $callback_payload['meta']['time'];

# retrieve transfer and deposit attributes
$included_transfer = array_filter(
  $callback_payload['included'],
  function ($item) {
    return $item['type'] === 'transfer';
  }
);
$included_transfer = array_pop($included_transfer)['attributes'];
$deposit = $callback_payload['data']['attributes'];

$status = $included_transfer['status'];
$amount = $included_transfer['amount'];
$tracking_id = $deposit['tracking_id'];

# prepare data for hash check
$message = $status . $amount . $tracking_id . $callback_time;
$hash_secret = hash('sha256', $login . $password, true);
$hash_hmac_result = hash_hmac('sha256', $message, $hash_secret);

# print result
if ($hash_hmac_result === $callback_sign) {
  echo 'Verified';
} else {
  echo 'Invalid sign';
}
echo PHP_EOL;
```

{% endcode %}

</details>

### Callback structure

The callback consists of three parts:

* `data` — the deposit itself. Contains the [Deposit object](#deposit-object).
* `included` — the transaction received for this deposit. Contains the [Currency object](https://docs.b2binpay.com/currency-methods#currency-object) and [Transfer object](https://docs.b2binpay.com/transfer-methods#transfer-object) (optional). There may be no Transfer object, if only the deposit status has changed. Keep in mind that transfer confirmation and deposit status changes are separate events that trigger two different callbacks.
* `meta` — the metadata used for callback authentication. Contains the following fields:
  * `time` (string) — the date and time when the callback was sent.
  * `sign` (string) — the HMAC signature for a callback authentication. Refer to the [Callback verification](#callback-verification) section for a callback verification example.

#### Callback body example

{% code overflow="wrap" %}

```json
{
  "data": {
    "type": "deposit",
    "id": "11203",
    "attributes": {
      "address": "0xcb959a408cbfbe64116a2dadc20188c290226fae",
      "created_at": "2022-07-15T16:51:52.702456Z",
      "tracking_id": "",
      "target_paid": "0.300000000000000000",
      "destination": {
        "address_type": null,
        "address": "0xcb959a408cbfbe64116a2dadc20188c290226fae"
      }
    },
    "relationships": {
      "currency": {
        "data": {
          "type": "currency",
          "id": "1002"
        }
      },
      "wallet": {
        "data": {
          "type": "wallet",
          "id": "318"
        }
      },
      "transfer": {
        "data": {
          "type": "transfer",
          "id": "17618"
        }
      }
    }
  },
  "included": [
    {
      "type": "currency",
      "id": "1002",
      "attributes": {
        "iso": 1002,
        "name": "Ethereum",
        "alpha": "ETH",
        "alias": null,
        "exp": 18,
        "confirmation_blocks": 3,
        "minimal_transfer_amount": "0.000000000000000000",
        "block_delay": 30
      }
    },
    {
      "type": "transfer",
      "id": "17618",
      "attributes": {
        "op_id": 11203,
        "op_type": 1,
        "amount": "0.300000000000000000",
        "commission": "0.001200000000000000",
        "fee": "0.000000000000000000",
        "txid": "0xa09cb1de38b9b21712ff18d08d6a625cc80ec41c9e64586095d4c46449a9eb51",
        "status": 2,
        "user_message": null,
        "created_at": "2022-07-15T16:53:04.098536Z",
        "updated_at": "2022-07-15T16:54:39.903843Z",
        "confirmations": 8,
        "risk": 0,
        "risk_status": 4,
        "amount_cleared": "0.298800000000000000"
      },
      "relationships": {
        "currency": {
          "data": {
            "type": "currency",
            "id": "1002"
          }
        }
      }
    }
  ],
  "meta": {
    "time": "2022-07-15T16:54:39.966327+00:00",
    "sign": "1377e7a9eb3d62f7708285cd148711c62f50e53d8046e4d412a18ae9a575da85"
  }
}
```

{% endcode %}

***

## Deposit options

### Request

<mark style="color:green;">`OPT`</mark> `[base]/deposit`

*No request parameters.*

#### Request example

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request OPTIONS \
--url [base]/deposit/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests
import json

url = "[base]/deposit/"

headers = {
  'Content-Type': 'application/vnd.api+json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("OPTIONS", url, headers=headers)

print(response.text)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code overflow="wrap" %}

```php
<?php

$client = new Client();
$headers = [
  'Content-Type' => 'application/vnd.api+json',
  'Authorization' => 'Bearer <token>'
];
$request = new Request('OPTIONS', '[base]/deposit/', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Response

In case of success, the response body contains an array of available methods along with a list of field parameters such as labels, min and max values, regular expressions used for validation, and so on.

#### Response codes

<table><thead><tr><th width="134">HTTP code</th><th width="213">Description</th><th>Suggested action</th></tr></thead><tbody><tr><td><mark style="color:green;"><code>200</code></mark></td><td>The request succeeded.</td><td>—</td></tr><tr><td><mark style="color:red;"><code>500</code></mark></td><td>Internal server error.</td><td>The request wasn’t completed due to an internal error on the server side.</td></tr></tbody></table>

#### Response body example

{% code overflow="wrap" %}

```json
{
  "data": {
    "renders": [
      "application/vnd.api+json"
    ],
    "parses": [
      "application/vnd.api+json",
      "multipart/form-data"
    ],
    "allowed_methods": [
      "GET",
      "POST",
      "HEAD",
      "OPTIONS"
    ],
    "actions": {
      "GET": {
        "currency": {
          "lookup_expr": "exact",
          "regexp": "^[1-9][0-9]*$",
          "max_length": 8,
          "required": false
        },
        "wallet": {
          "lookup_expr": "exact",
          "required": false
        },
        "wallet_from": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "wallet_to": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "wallet_type": {
          "lookup_expr": "exact",
          "choices": [
            {
              "value": 1,
              "display_name": "Merchant"
            },
            {
              "value": 2,
              "display_name": "Enterprise"
            },
            {
              "value": 3,
              "display_name": "Custody"
            },
            {
              "value": 4,
              "display_name": "NFT"
            },
            {
              "value": 5,
              "display_name": "Swap"
            }
          ],
          "required": false
        },
        "id": {
          "lookup_expr": "exact",
          "regexp": "^[1-9][0-9]*$",
          "max_length": 8,
          "required": false
        },
        "created_at_from": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "created_at_to": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "updated_at_from": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "updated_at_to": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "label": {
          "lookup_expr": "icontains",
          "max_length": 32,
          "required": false
        },
        "tracking_id": {
          "lookup_expr": "icontains",
          "max_length": 128,
          "required": false
        },
        "commission": {
          "lookup_expr": "exact",
          "regexp": "[-+]?[0-9]*\\.?[0-9]*",
          "max_length": 32,
          "required": false
        },
        "address": {
          "lookup_expr": "exact",
          "max_length": 256,
          "required": false
        },
        "confirmations_needed": {
          "lookup_expr": "exact",
          "regexp": "^[1-9][0-9]*$",
          "max_length": 2,
          "required": false
        },
        "help_email": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "status": {
          "lookup_expr": "exact",
          "choices": [
            {
              "value": 2,
              "display_name": "Created"
            },
            {
              "value": 3,
              "display_name": "Paid"
            },
            {
              "value": 4,
              "display_name": "Canceled"
            },
            {
              "value": 5,
              "display_name": "Unresolved"
            }
          ],
          "required": false
        },
        "time_limit": {
          "lookup_expr": "exact",
          "regexp": "^[1-9][0-9]*$",
          "max_length": 8,
          "required": false
        },
        "inaccuracy": {
          "lookup_expr": "icontains",
          "max_length": 32,
          "required": false
        },
        "target_amount_requested": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "rate_requested": {
          "lookup_expr": "exact",
          "max_length": 32,
          "required": false
        },
        "expired_at_from": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "expired_at_to": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "target_paid": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "enrolled": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "target_paid_pending": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "source_paid_pending": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "source_paid": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "source_commission": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        },
        "source_amount_requested": {
          "lookup_expr": "exact",
          "max_length": 64,
          "required": false
        }
      },
      "POST": {
        "status": {
          "type": "choice",
          "required": false,
          "read_only": false,
          "label": "Status",
          "choices": [
            {
              "value": 2,
              "display_name": "Created"
            },
            {
              "value": 3,
              "display_name": "Paid"
            },
            {
              "value": 4,
              "display_name": "Canceled"
            },
            {
              "value": 5,
              "display_name": "Unresolved"
            }
          ]
        },
        "currency": {
          "type": "field",
          "required": false,
          "read_only": false,
          "label": "Currency"
        },
        "address_type": {
          "type": "string",
          "required": false,
          "read_only": false,
          "label": "Address type",
          "max_length": 16
        },
        "wallet": {
          "type": "field",
          "required": true,
          "read_only": false,
          "label": "Wallet"
        },
        "label": {
          "type": "string",
          "required": false,
          "read_only": false,
          "label": "Label",
          "max_length": 32
        },
        "tracking_id": {
          "type": "string",
          "required": false,
          "read_only": false,
          "label": "Tracking id",
          "max_length": 128
        },
        "confirmations_needed": {
          "type": "integer",
          "required": false,
          "read_only": false,
          "label": "Confirmations needed",
          "min_value": 0,
          "max_value": 100
        },
        "callback_url": {
          "type": "url",
          "required": false,
          "read_only": false,
          "label": "Callback url",
          "max_length": 256
        },
        "inaccuracy": {
          "type": "decimal",
          "required": false,
          "read_only": false,
          "label": "Inaccuracy",
          "min_value": 0
        },
        "time_limit": {
          "type": "integer",
          "required": false,
          "read_only": false,
          "label": "Time limit",
          "min_value": 59,
          "max_value": 2147483647
        },
        "target_amount_requested": {
          "type": "decimal",
          "required": false,
          "read_only": false,
          "label": "Target amount requested",
          "min_value": 0
        },
        "payment_page": {
          "type": "field",
          "required": false,
          "read_only": true,
          "label": "Payment page"
        },
        "travel_rule_info": {
          "type": "field",
          "required": false,
          "read_only": false,
          "label": "Travel rule info"
        }
      }
    }
  }
}
```

{% endcode %}
