Deposits

Use the following methods to deposit funds to client wallets or trading accounts opened on the B2Trader, MetaTrader 4/5 and cTrader platforms.

You can choose to make a deposit by sending a synchronous or asynchronous request.

When making a synchronous deposit, it appears to your clients as completed immediately, although the amount is actually deposited to a client wallet or account after the deposit transaction is processed by a payment system.

When making an asynchronous deposit, it appears to your clients as completed only after the deposit transaction is processed by a payment system and a message about either outcome (deposit_done or deposit_failed) is returned via the B2Core WebSocket API.

Important

When making asynchronous deposits, monitor their execution by using the B2Core WebSocket API.

POST[host]/api/v2/my/deposits/sync

Make a synchronous deposit

POST[host]/api/v2/my/deposits

Make an asynchronous deposit

Make a synchronous deposit

Use this method to make a synchronous deposit to a client wallet or trading account.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Body

Specify the following parameters for a deposit transaction:

accountId integer required

The identifier of an account to which funds are to be deposited.

methodId integer required

The identifier of a deposit method.

currencyCode integer required

The numeric code of a currency in which a deposit is made.

amount number

The deposit amount.

This parameter is only required when depositing to a wallet or account denominated in a fiat currency.

It isn’t required when depositing to a coin or stablecoin wallet or account.

isPretend boolean

If true, a transaction preview is available before a transaction is created in B2Core; otherwise, false.

For a preview, a Transaction object providing deposit transaction details is returned within the data object described below.

appInstanceId string

The identifier of an application instance associated with a selected deposit method.

data object

An array of string values indicating configuration settings specific to a selected deposit method.

The configuration settings for each deposit method can be found on the Settings tab in the method details upon navigating to System > Deposit system > Deposit methods in the Back Office.

POST[host]/api/v2/my/deposits/sync

curl --location --request POST 'https://host.name/api/v2/my/deposits/sync' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "accountId": 4769,
  "methodId": 27,
  "currencyCode": 1000,
  "isPretend": false,
  "data": {
    "address_type": "p2sh-segwit"
  }
}'

Response

A response contains the following data about a created deposit transaction:

invoice string

The invoice identifier.

action object

The details about actions required to complete a deposit.

Show object fields
action string or null

The format in which transaction details are presented. Possible values:

  • PAGE— the raw data

  • TABLE— the data presented in a table

params object

The details specific to a deposit transaction.

When depositing to a coin or stablecoin wallet or account, this object includes a hash string indicating the address to which funds are to be deposited. The address must be used by a client to complete the deposit using their external wallet.

transactionId integer

The identifier of a deposit transaction, followed by other transaction data. See the Transaction object to learn more.

RESPONSE EXAMPLE
{
 "invoice": "",
 "action": {
   "action": "PAGE",
   "params": {
     "qrCode": true,
     "address": "2MuteS8CpyHYoxyCepfb218kkCzuShjuKS4",
     "message": "",
     "currency": "BTC"
 },
 "transactionId": "2657"  
}

Make an asynchronous deposit

Use this method to make an asynchronous deposit to a client wallet or trading account. To monitor execution of asynchronous deposits, use the B2Core WebSocket API.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Body

Specify the following parameters for a deposit transaction:

accountId integer required

The identifier of an account to which funds are to be deposited.

methodId integer required

The identifier of a deposit method.

currencyCode integer required

The numeric code of a currency in which a deposit is made.

amount number

The deposit amount.

This parameter is only required when depositing to a wallet or account denominated in a fiat currency.

It isn’t required when depositing to a coin or stablecoin wallet or account.

isPretend boolean

If true, a transaction preview is available before a transaction is created in B2Core; otherwise, false.

For a preview, a Transaction object providing deposit transaction details is returned within the data object described below.

appInstanceId string

The identifier of an application instance associated with a selected deposit method.

data object

An array of string values specifying configuration settings specific to a selected deposit method.

The configuration settings for each deposit method can be found on the Settings tab in the method details upon navigating to System > Deposit system > Deposit methods in the Back Office.

POST[host]/api/v2/my/deposits

curl --location --request POST 'https://host.name/api/v2/my/deposits' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "accountId": 4768,
  "methodId": 6,
  "amount": 100,
  "currencyCode": 1000,
  "isPretend": false,
  "appInstanceId": "123123",
  "data": {
    "field": "value"
  }
}'

Response

A response contains the following data about a deposit transaction created in B2Core:

invoice string

The invoice identifier.

action object

The details about actions required to complete a deposit.

Show object fields
action string

The format in which transaction details are presented. Possible values:

  • PAGE— raw data

  • TABLE— a data table

params object

The details specific to a deposit transaction.

When depositing to a coin or stablecoin wallet or account, this object includes a hash string indicating the address to which funds are to be deposited. The address must be used by a client to complete the deposit using their external wallet.

transactionId integer

The identifier of a deposit transaction, followed by other transaction data. See the Transaction object to learn more.

RESPONSE EXAMPLE
{
 "invoice": "393/4768",
 "action": {
   "action": "TABLE",
   "params": {
     "caption": "Amount"
     "value": 100
 },
 "transactionId": "2659"  
}

After a deposit transaction is created in B2Core, an asynchronous request to execute this transaction is sent to the required payment system. To monitor execution of asynchronous deposits, use the B2Core WebSocket API.