Withdrawals

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

GET[host]/api/v2/my/withdrawals/wizard

Initialize a wizard for withdrawing funds

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

Make a withdrawal

POST[host]/api/v2/my/withdrawals/wizard

Confirm a withdrawal

Initialize a wizard for withdrawing funds

Use this method to initialize a wizard for withdrawing funds.

Request

Header parameters:

  • Authorization: Bearer <access_token>

GET[host]/api/v2/my/withdrawals/wizard

curl --location --request GET 'https://host.name/api/v2/my/withdrawals/wizard' \
--header 'Authorization: Bearer <token>'

Response

code integer

An HTTP code specifying the current step in a progression of wizard pages:

  • HTTP code 200 for an intermediary step after which another page of a withdrawal form is displayed to a client

  • HTTP code 202 for a final wizard step signaling that a withdrawal procedure completed

data object or null

Always null for this wizard type.

done boolean

If true, a withdrawal procedure has succeeded; otherwise, false.

uuid string

The universally unique identifier (UUID) assigned to a withdrawal procedure.

workflow string

A string value indicating the current stage of a withdrawal procedure.

RESPONSE EXAMPLE
{
  "code": 202,
  "data": [],
  "done": true,
  "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732",
  "workflow": "B2B\\TCA\\Wizards\\Workflow\\TerminateWorkflow"
}

Make a withdrawal

Use this method to withdraw funds from a client wallet or trading account.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Body

Specify the following parameters for a withdrawal transaction:

accountId integer required

The identifier of an account from which funds are to be withdrawn.

methodId integer required

The identifier of a withdrawal method.

amount number required

The withdrawal amount.

currencyCode integer required

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

uuid string required

The universally unique identifier (UUID) obtained after initializing a wizard for withdrawing funds.

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 withdrawal transaction details is returned within the data object described below.

data object

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

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

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

{
  "accountId": 4488,
  "methodId": 2,
  "amount": 100,
  "currencyCode": 1000,
  "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732",
  "isPretend": true,
  "data": {
    "field": "value"
  }
}

Response

If the withdrawal wizard includes a 2FA step, a response contains the data about a verification code delivery.

Next, use the method to confirm a withdrawal to complete a withdrawal transaction.

status integer

The wizard status.

sent integer

Indicates whether a verification code was sent to a client. Possible values:

  • 0 — a code wasn’t sent to a client

  • 1 — a code was successfully sent to a client

expiredAt string

The date and time when a verification code expires.

sentAt string

The date and time when a verification code was sent to a client.

recipient object

The details about a verification code delivery.

Show object fields
template string

The name of a template used to deliver a verification code.

email string

If a withdrawal is configured to be confirmed by email, the client email address to which a verification code was sent.

name string

The client’s name.

method string

The method used to deliver a verification code to a client. Possible values:

  • email — the code is sent to a client email address

  • sms — the code is sent to a client phone number

  • google — a code from the Google Authenticator app must be used to confirm a withdrawal transaction

RESPONSE EXAMPLE
{
  "status": 0,
  "sent": 1,
  "expiredAt": "2022-01-01T00:00:00+00:00",
  "sentAt": "2022-01-01T00:00:00+00:00",
  "recipient": {
    "template": "Withdraw_Confirm",
    "email": "john.doe@gmail.com",
    "name": "John Doe",
    "method": "email"
  }
}

If the withdrawal wizard doesn’t include a 2FA step, a response contains a Transaction object providing information about the withdrawal transaction that has been made.

Confirm a withdrawal

Use this method to confirm a withdrawal by using a verification code from the Google Authenticator app or a code delivered to a client email address or phone number.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Body

Specify the following parameters:

data object

The object containing the following fields:

action string required

Specify code to indicate that a verification code is required to confirm a withdrawal.

code string required

The verification code from the Google Authenticator app or a code delivered to a client email address or phone number.

uuid string required

The universally unique identifier (UUID) obtained after initializing a wizard for withdrawing funds.

POST[host]/api/v2/my/withdrawals/wizard

curl --location --request POST 'https://host.name/api/v2/my/withdrawals/wizard' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "data": {
    "action": "code",
    "code": "10102",
    "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732"
  }
}'

Response

code integer

An HTTP code specifying the current step in a progression of wizard pages:

  • HTTP code 200 for an intermediary step after which another page is displayed to a client

  • HTTP code 202 for a final wizard step signaling that a confirmation procedure completed

data object

Always null for this wizard type.

done boolean

If true, a confirmation procedure has succeeded; otherwise, false.

uuid string

The universally unique identifier (UUID) assigned to a confirmation procedure.

workflow string

A string value indicating the current stage of a confirmation procedure.

After a withdrawal is confirmed with a verification code, a Transaction object is returned, providing information about the withdrawal transaction that has been made.

RESPONSE EXAMPLE
{
  "code": 202,
  "data": [],
  "done": true,
  "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732",
  "workflow": "B2B\\TCA\\Wizards\\Workflow\\TerminateWorkflow"
}