Withdrawal API

To find out how to create an API key visit API key page.

The merchant API uses Bearer authentification via HTTP headers. You need to provide the header ‘Authorization‘ with your API key that can be found in merchant panel. Each request must have the header in the following format: Authorization: Bearer <API_KEY>

Error response

All endpoints return the following JSON response if some error is occured (non 200 status):

{
    "error": {
        "code": 0 ,
        "reason": "string",
        "description": "string"
    }
}

Create withdrawal request

Endpoint

POST /api/merchant_withdrawal/create

Request body

{
  "currency": {
    "Crypto": "Btc"
  },
  "amount": {
    "Crypto": {
      "Btc": 0
    }
  },
  "address": "string",
  "callback": "string",
  "external_order_id": "string",
  "memo": "string"
}

Description of request body

  • currency is mandatory field that specifies which currency to use for the invoice. The table of accepted values is located here. If funds are insufficient, than Thai Digital Wallet checks balance in another currencies, rates and make automatic swap.
  • amount is mandatory field that contains information about the equivalent of funds in another currency in which merchant needs to make a withdrawal. Amounts are specified in integral format with respect of decimal fields.

    For example: merchant needs to withdraw BTC in the amount of 1000 USD. For the USD the decimals value is 2. API will be look like:

{
    "currency": {
    "Crypto": "Btc"
    },
    "amount": {
        "Fiat": {
        "USD": 100000
        }
    },
}
  • address is mandatory field that contains information about the address to which funds will be transferred from the balance of merchant.
  • callback is optional field that specifies URL where the response of Thai Digital Wallet will be sent.
  • external_order_id is optional numeric number for merchant. It is used for identidication of withdrawal inside a system of merchant.
  • memo is manadatory field for withdrawal of XLR and currencies based on it.

Response

The endpoint returns 200 HTTP status with single quoted string for created withdrawal ID.

"string"

View withdrawal

Endpoint

GET /api/merchant_withdrawal

Query parametrs

/api/merchant_withdrawal?<id>

Description of query parameters

  • id is ID of withdrawal.

Response

The endpoint returns 200 HTTP status with JSON describing the withdrawal.

{
    "id": "string",
    "external_id": 0,
    "merchant_id": "string",
    "currency": {
        "Crypto": "Btc"
    },
    "amount": {
        "Crypto": {
        "Btc": 0
        }   
    },
    "statuses": [{
        "status": "New", 
        "at": "string"
        }
    ],
    "current": "New",    
    "address": "string",
    "is_testnet": "boolean",
    "callback": "string",
    "external_order_id": "string",
}

Description of response

  • id is ID of withdrawal.
  • external_id is numeric field for merchant. It is used for identidication of withdrawal inside a system of merchant.
  • merchant_id is ID of merchant.
  • currency is field that specifies which currency to use for the invoice. The table of accepted values is located here. If funds are insufficient, than Thai Digital Wallet checks balance in another currencies, rates and make automatic swap.
  • amount is field that contains information about the equivalent of funds in another currency in which merchant needs to make a withdrawal. Amounts are specified in integral format with respect of decimal fields.
  • statuses is the list of statuses of withdrawal with timestamps of getting them.
  • current is the current status of withdrawal.
  • address is address to which funds will be sent from the balance of merchant.
  • is_testnet is boolean, which says withdrawal in testnet or not.
  • callback is specified URL where the response of Thai Digital Wallet will be sent.
  • external_order_id is same as external_id, but string.

List of withdrawals

Endpoint

POST /api/merchant_withdrawal/list

Query parameters

/api/merchant_withdrawal/list?<page>&<page_size>

Description of query parameters

  • page is number which specifies the page in history. Integer.
  • page_size is number of withdrawals per page. Integer.

Request body

{
  "from": "string",
  "to": "string",
  "currencies": [
    {
      "Crypto": "Btc"
    },
    {
      "Fiat": "Usd"
    }
  ],
  "tags": [
    "New"
  ]
}

Description of request body

  • from is optional field of required period's start
  • to is optional field of required period's end
  • currencies is required field that describes withdrawals with required currencies. If filtering by this parameter is not required, than an empty list is set: {"currencies": []}
  • tags is required field that describes withdrawals with required tags. If filtering by this parameter is not required, than an empty list is set: {"tags": []}

Response

The endpoint returns 200 HTTP status with JSON describing list of filtered witdrawals.

{
    "page_content": [
        {
        "id": "string",
        "external_id": 0,
        "merchant_id": "string",
        "currency": {
            "Crypto": "Btc"
        },
        "amount": {
            "Crypto": {
            "Btc": 0
            }
        },
        "statuses": [
            {
            "status": "New",
            "at": "string"
            }
        ],
        "current": "New",
        "address": {
            "Crypto": {
                "currency": "Usd",
                "address": "string"
            }
        },
        "is_testnet": true,
        "callback": "string",
        "external_order_id": "string"
        }
    ],
    "page_count": 0,
    "total": 0
}

Description of response

  • page_content is the list of withdrawals on specified page.
  • id is ID of withdrawal.
  • external_id is numeric field for merchant. It is used for identidication of withdrawal inside a system of merchant.
  • merchant_id is ID of merchant.
  • currency is field that specifies which currency to use for the invoice. The table of accepted values is located here. If funds are insufficient, than Thai Digital Wallet checks balance in another currencies, rates and make automatic swap.
  • amount is field that contains information about the equivalent of funds in another currency in which merchant needs to make a withdrawal. Amounts are specified in integral format with respect of decimal fields.
  • statuses is the list of statuses of withdrawal with timestamps of getting them.
  • current is the current status of withdrawal.
  • address is address to which funds will be sent from the balance of merchant.
  • is_testnet is boolean, which says withdrawal in testnet or not.
  • callback is specified URL where the response of Thai Digital Wallet will be sent.
  • external_order_id is same as external_id, but string.
  • page_count is number of pages.
  • total is number of withdrawals matching the filters.