API (Интерфейс прикладного программирования)

API - Интерфейс прикладного программирования
Все запросы должны выполняться через HTTPS.
Поддерживается JSON-RPC. Чтобы использовать JSON-RPC, добавьте .json в конце запроса.

Запросы ОТПРАВКИ

Поддерживается JSON-RPC.

Создать Заказ

Создайте обменный курс для определенного направления обмена. Вы можете указать, сколько вам нужно отправить или получить с помощью параметров deposit_amount или withdraw_amount.
url: https://www.alfacashier.com/api/create.json
method: POST
data required:
{
  "pair": "Example: 'BTC_LTC', direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].", // currency codes
  "deposit_amount": "(Optional*) example: '4.953', fixed deposit amount you'd like to send for an exchange.",
  "withdrawal_amount": "(Optional*) example: '6.431', fixed withdrawal amount you'd like to get after an exchange is made.",
  "email": "Example: 'email@example.com', your e-mail address.",
  "options": "Example: {'address': '1FgThhtLdSM1i78vXHGovA3WxzbTWA2mse'} This array of parameters depends on source_currency_code", // array of params
  "r_uid": "(Optional) Referral ID", // Affiliate program Referral ID
}

Success Output example:
{
  "secret_key": "Example: '11fb9a42045b0bf35ef40b8e96e45ebe', your order unique secret key which is used to track your order's status.",
  "deposit": "(Array) depending on deposit coin, there will be deposit address, array structure is the same as options."
}

Error Output example:
{"error":"Missing required argument pair"}
cURL (example):
curl -X POST https://www.alfacashier.com/api/create.json \
     -H "Content-Type:application/json" \
     --data '{"pair":"BTC_LTC","deposit_amount":"1.4561","email":"email@example.com","options":[{"address":"mnD8wHZKfdSwoKyW4H44spK2MqGAEXNbG9"}]}'
Response (example):
{
  "secret_key": "fdce47f91e4b28c50e9f08beb4e43dee",
  "deposit": {"address":"n1S9pzENwn3QQgHcCE3afyxVrL57798eA2"},
  "deposit_amount": 0.00827399,
  "withdrawal_amount": 0.87673802
}

Получить Текущий Курс Обмена

Этот метод возвращает текущий обменный курс между валютами, указанными в паре на данный момент. Обменный курс может быстро меняться в зависимости от рынка.
url: https://www.alfacashier.com/api/rate.json
method: POST
data required:
{
  "pair": "Example: 'BTC_LTC', direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].",
  "deposit_amount": "(Optional*) example: '4.952', fixed deposit amount you'd like to send for an exchange.",
  "withdrawal_amount": "(Optional*) example: '6.431', fixed withdrawal amount you'd like to get after an exchange is made.",
}

Success Output:
{
  "rate": 1.213456
}
cURL (example):
curl -X POST https://www.alfacashier.com/api/rate.json \
     -H "Content-Type:application/json" \
     --data '{"pair":"BTC_LTC"}'
Response (example):
{
   "rate" : "108.82046494"
}

Подтвердить Адрес

Проверьте указанный валютный адрес/учетную запись с дополнительными параметрами, такими как destination_tag, message или payment_id.
url: https://www.alfacashier.com/api/validateaddress.json
method: POST
data required:
{
  currency: "Currency code", // example: "BTC", currency codes
  "options": "Example: {'address': '1FgThhtLdSM1i78vXHGovA3WxzbTWA2mse'} This array of parameters depends on source_currency_code" // array of params
}

success output:
{
  valid: true,
}

Error Output example:
{"error":"Invalid payment_id"}
cURL (example):
curl -X POST https://www.alfacashier.com/api/validateaddress.json \
     -H "Content-Type:application/json" \
     --data '{"currency":"XMR","address":"46ao2KDAy7fduSxuqFNw389JnLLJYgLrbG6iNyNt37e2D3kqg4QwAmYicyGX6aQ4x3GEHtPQDSGuUXGsTxjr5A2A6oWiaXr","payment_id":"abcdef1234567890abcdef1234567890abcdef1234567890abcdef12345abcde"}'
Response (example):
{
  valid: true
}

Запросы ПОЛУЧЕНИЯ

Поддерживаются как REST, так и JSON-RPC. Чтобы использовать JSON-RPC, добавьте .json в конце запроса.

Получить Статус Заказа

Возвращает статус заказа и некоторую дополнительную информацию.
url: https://www.alfacashier.com/api/status/[secret_key]
method: GET
data required:
[secret_key] is the secret key of the order, you can get one by creating an order.

Success Output (example):  

Status: Expired
{
  pair: "BTC_LTC",
  status: "expired",
  deposit: "(Array) Deposit address or account, and tags",
  withdrawal: "(Array) Withdrawal address or account, and tags",
  received_amount: "[double]", // total received amount
  deposit_amount: "[double]", // amount received on deposit address, used for exchange
  withdrawal_amount: "[double]", // amount to sent
  seconds_remaining: "[int]", // order time remaining before expire
}
cURL (example):
curl -X GET https://www.alfacashier.com/api/status/11fb9a42045b0bf35ef40b8e96e45ebe \
     -H "Content-Type:application/json"
Response (example):
{
  "pair":"BTC_LTC",
  "status":"new",
  "deposit":{"bitcoin":{"address":"n2ys7Txor5v2D49zrqJ5dG2BhjYe1e2uTu"}},
  "withdrawal":[],
  "received_amount":"0.00018868",
  "deposit_amount":0.00018868,
  "withdrawal_amount":0.01031042,
  "time_created":"2017-11-29 11:57:56",
  "seconds_remaining":7199
}

Получить Лимиты Обменов

Получите лимиты вывода и пополнения для указанного направления обмена в настоящий момент.
url: https://www.alfacashier.com/api/limit/[pair]
method: GET
data required:
[pair] - example: "BTC_LTC", direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].


Success output:
{
  deposit_min: 0.1,
  deposit_max: 2,
  withdrawal_min: 0.2,
  withdrawal_max: 200,
  deposit_day_limit: 1,
  deposit_month_limit: 10,
  withdrawal_day_limit: 1000,
  withdrawal_month_limit: 10000,
}
cURL (example):
curl -X GET https://www.alfacashier.com/api/limit/BTC_LTC \
     -H "Content-Type:application/json"
Response (example):
{
  "deposit_min" : 0.0002764,
  "deposit_month_limit" : 0,
  "withdrawal_day_limit" : 15.503875944955,
  "deposit_day_limit" : 0,
  "withdrawal_min" : 0.01550388,
  "withdrawal_month_limit" : 46.511627834866,
  "withdrawal_max" : 0.98130298,
  "deposit_max" : 0.00901763
}

Список Поддерживаемых Валют

Список содержит имя, код валюты и статус доступности для внесения и снятия поддерживаемых валют по API.
url: https://www.alfacashier.com/api/getcoins
method: GET

success output:
{
  "bitcoin":{
    "currency":"BTC",
    "title":"Bitcoin",
    "deposit":true,
    "withdrawal":true
  },
  "litecoin":{
    "currency":"LTC",
    "title":"Litecoin",
    "deposit":false,
    "withdrawal":false
  }, ...
},
cURL (example):
curl -X GET https://www.alfacashier.com/api/getcoins \
     -H "Content-Type:application/json"
Response (example):
{
  "litecoin" : {
    "currency" : "LTC",
    "withdrawal" : false,
    "deposit" : false,
    "title" : "Litecoin"
  },
  "nem" : {
    "currency" : "XEM",
    "withdrawal" : true,
    "deposit" : true,
    "title" : "NEM"
  },
  "monero" : {
    "currency" : "XMR",
    "withdrawal" : true,
    "deposit" : true,
    "title" : "Monero"
  },
  "zcash" : {
    "currency" : "ZEC",
    "withdrawal" : false,
    "deposit" : false,
    "title" : "Zcash"
  },
  "ethereum" : {
    "deposit" : true,
    "title" : "Ethereum",
    "currency" : "ETH",
    "withdrawal" : true
  },
  "ripple" : {
    "title" : "Ripple",
    "deposit" : true,
    "currency" : "XRP",
    "withdrawal" : true
  },
  "dash" : {
    "title" : "Dash",
    "deposit" : true,
    "withdrawal" : true,
    "currency" : "DASH"
  },
  "bitcoin" : {
    "withdrawal" : true,
    "currency" : "BTC",
    "title" : "Bitcoin",
    "deposit" : false
  }
}

Структуры

Доступные валютные коды

BTC - Bitcoin,
LTC - Litecoin,
ETH - Ethereum,
XRP - Ripple,
DASH - Dash,
XMR - Monero,
BCH - Bitcoin Cash,
XEM - NEM,
ZEC - Zcash,
ETC - Ethereum Classic.

Параметры адреса

1) Bitcoin, Litecoin, Ethereum, Dash, ZCash, Bitcoin Cash, Ethereum Classic:
  options = {address: BITCOINADDRESS}
  address is your cryptocurrency address.
2) Ripple
  options = {account: RIPPLEACCOUNT, destination_tag: DESTTAG}
  account is your Ripple account and destination_tag is Destination Tag (some exchangers require it).
3) NEM
  options = {address: XEMADDRESS, message: MESSAGE}
  address is your NEM address and message is an optional parameter if you're using shared NEM wallet.
4) Monero
  options = {address: MONEROADDRESS, payment_id: PAYMENTID}
  address if your Monero address and payment_id is an optional parameter if you're using shared Monero wallet.