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].",
  "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'",
  "options": "Example: {'address': '1FgThhtLdSM1i78vXHGovA3WxzbTWA2mse'}, this array of parameters depends on source_currency_code.",
  "r_uid": "(Optional) example: '12345', affiliate program Referral ID.",
  "promo_code": "(Optional) example: 'ALFACODE'."
}
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.",
  "promo_code_discount": "(Optional) example: '10', discount percent returned from promo code validation." 
}
Success Output example:
{"rate": 1.213456}
Error Output example:
{"error": "Invalid pair"}
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 example:
{"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}

Promo Code Validation

Validates Promo Code for specific exchange direction (pair).
URL: https://www.alfacashier.com/api/promo_code.json
Method: POST

Data required:
{
  "code": "Example: 'ALFACODE'",
  "pair": "Example: 'BTC_LTC', direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].", 
}
Success Output example:
{"discount": "10"}
Error Output example:
{"error": "Invalid Promo Code"}
cURL (example):
curl -X POST https://www.alfacashier.com/api/promo_code.json \
     -H "Content-Type:application/json" \
     --data '{"code":"ALFACODE","pair":"BTC_LTC"}'
Response (example):
{"discount": "10"}

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

Поддерживаются как 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:
{
  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
}
Error Output example:
{"error": "Invalid transaction"}
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/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 example:
{
  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,
}
Error Output example:
{"error": "Invalid pair"}
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 example:
{
  "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
  },
  "xrp" : {
    "title" : "XRP",
    "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 - XRP,
DASH - Dash,
XMR - Monero,
BCH - Bitcoin Cash,
XEM - NEM,
ZEC - Zcash,
ETC - Ethereum Classic.

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

1) Bitcoin, Litecoin, Ethereum, Dash, ZCash, Ethereum Classic:
  options = {address: BITCOINADDRESS}
  address is your cryptocurrency address.
2) Bitcoin Cash
  options = {address: BITCOINCASHADDRESS, legacy_address: LEGACYBITCOINCASHADDRESS}
  address is your cryptocurrency address.
3) XRP
  options = {account: XRPACCOUNT, destination_tag: DESTTAG}
  account is your XRP account and destination_tag is Destination Tag (some exchangers require it).
4) NEM
  options = {address: XEMADDRESS, message: MESSAGE}
  address is your NEM address and message is an optional parameter if you're using shared NEM wallet.
5) 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.