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:
{"pair": "BTC_LTC", "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:
{"pair": "BTC_LTC", "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:
{
  pair: "BTC_LTC",
  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):
{
  "pair": "BTC_LTC",
  "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,
    "explorer_tx_link": "https://www.blockchain.com/btc/tx/%hash%",
    "explorer_address_link": "https://www.blockchain.com/btc/address/%address%"
  },
  "litecoin":{
    "currency":"LTC",
    "title":"Litecoin",
    "deposit":false,
    "withdrawal":false,
    "explorer_tx_link": "https://insight.litecore.io/tx/%hash%",
    "explorer_address_link": "https://insight.litecore.io/address/%address%"
  }
}
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
  },
  "tether" : {
    "withdrawal" : true,
    "currency" : "USDT",
    "title" : "Tether",
    "deposit" : true
  },

}

Структуры

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


Type CodeCurrency CodePayment Method
bitcoin BTC
Bitcoin
xrp XRP
XRP
ethereum ETH
Ethereum
bitcoincash BCH
Bitcoin Cash
litecoin LTC
Litecoin
eos EOS
EOS
stellar XLM
Stellar
tether USDT
Tether
monero XMR
Monero
dash DASH
Dash
ethereumclassic ETC
Ethereum Classic
nem XEM
NEM
zcash ZEC
Zcash
omisego OMG
OmiseGO
augur REP
Augur
qtum QTUM
Qtum
trueusd TUSD
TrueUSD
usdcoin USDC
USD Coin
paxos PAX
Paxos Standard
zrx ZRX
0x
chainlink LINK
Chainlink
bat BAT
Basic Attention Token
holo HOT
Holo
golem GNT
Golem

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

1) Bitcoin, Tether, Litecoin, Ethereum, Dash, ZCash, Ethereum Classic:
  options = {address: BITCOINADDRESS}
  address is your cryptocurrency address.
2) Bitcoin Cash
  options = {address: BITCOINCASHADDRESS}
  address is your cryptocurrency address.
3) XRP
  options = {account: XRPACCOUNT, destination_tag: DESTTAG}
  account is your XRP account and destination_tag is Destination Tag.
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.
6) Stellar
  options = {account: XLMACCOUNT, memo: MEMO}
  account is your Stellar account and memo is Memo.
7) EOS
  options = {account: EOSACCOUNT, memo: MEMO}
  account is your EOS account name and memo is Memo.

API Libraries / Plugins

ALFAcashier API Libraries / CMS Plugins for various programming languages.