Руководство по интеграции платежных систем

Начало работы

OKchanger API позволяет клиентам автоматически получать доступ к информации об имеющихся направлениях обмена, обменниках и платежных системах, размещенных в мониторинге. Данный функционал может быть использован для предоставления пользователям Вашего ресурса дополнительной возможности пополнения счета.

Для использования API Вам необходимо создать специальный ключ для API в настройках профиля Вашего счета OKchanger.

Создание ключа API

Перед использованием функций API необходимо создать ключ для API в настройках профиля (раздел Ключи API).

Важно! В целях безопасности Вы можете создавать несколько API ключей, и каждый ключ API может быть сконфигурирован таким образом, чтобы иметь доступ только к определенным функциям.

Для создания ключа API нажмите на соответствующую ссылку на странице Ключи API. На новой странице нужно будет указать ключ API и создать пароль. Кроме того, укажите функции, которые планируете использовать с помощью данного ключа API. Нажмите Сохранить для получения ID ключа API. Он отобразится в списке существующие ключи API под колонкой ID. Идентификатор данного ключа ID ключа API наряду с паролем пароль API ключа понядобятся позднее для вызова функций API.

Схема авторизации

Все функции API требуют специальной подписи, которая формируется из значений переменных, отправляемых к функции и сортируются по имени переменных в порядке возрастания + пароль API, разделенный двоеточиями (:).

Например, если функция вызывается со следующими параметрами:

Rating_Directions_From (
	APIID = 21238,
	signature = ‘8bfea2057de0ddb965a8b4a7db877abf’,
	fromcurrencyname = ‘USD’,
	frompaysystemid = 10
)

В первую очередь, расположите все имена параметров функций в алфавитном порядке (Важно!):

  • APIID (=21238)
  • fromCurrencyName (=USD)
  • fromPaysystemId (=10)

Предполагая, что Ваш пароль для ключа API ‘AABBCC’ (в соответствии с настройками счета). После чего мы получаем md5 хэш следующей строки:

signature = md5 (‘21238:USD:10:AABBCC’)

Результат функции MD5 является:

signature = ‘8bfea2057de0ddb965a8b4a7db877abf’

Теперь, заполнив переменную signature вы готовы вызвать защищенную функцию Rating_Directions_From как указано выше.

Создание запросов API

Для любых запросов API требуется аутентификация. Вы можете узнать больше об аутентификации в разделе выше (см. Механизм авторизации выше).

Все запросы должны быть отправлены по следующему URL адресу:
https://www.okchanger.ru/API/Rating_PaySystems?apiid=21238&signature=c0f99c53ed30b0365bc7f7888eb8db53

Где: Rating_PaySystems — имя вызываемой функции.
               ?apiid=21238&signature=c0f99c53ed30b0365bc7f7888eb8db53 — запрошенные параметры.

Параметры могут быть отправлены через POST или GET методы.

Пример ответа:

{
	"ErrorMessage":" ... error message if occured ... ",
	"IsSuccess":"1",
	"Result":" ... some data ... "
}
Название Тип Пример Описание
ErrorMessage String API_Wrong_Hash Error code
IsSuccess Boolean true Operation success
Result Array/Object   Result

Функции API

Наш API содержит предсказуемые ресурсо-ориентированные URL-адреса и использует коды ответов HTTP для указания ошибок API. Мы поддерживаем CORS (совместное использование ресурсов между разными источниками), что позволяет безопасно взаимодействовать с API из веб-приложения на стороне клиента. JSON возвращается на все запросы API, включая ошибки, хотя наши библиотеки API преобразовывают ответы на соответствующий язык конкретных объектов.

Список доступных функций API приведен ниже. Каждая из них используется для определенной цели.


Ниже мы разберем каждую функцию более подробно.

Функция Rating_PaySystems

[Array of PaySystem Objects]  Rating_PaySystems  Integer APIID, String signature )

Эта функция предоставляет подробную информацию о платежных системах, участвующих в доступных направлениях обмена.

Параметры:

Название Тип Пример Описание
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature

Return value: Array of PaySystem Objects.

Пример ответа:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"ID":1,
	"Name":"Webmoney",
	"PaySystemType":"OnlinePaySystem",
	"LogoURL":"http://www.okchanger.ru/assets/images/ps/WEBMONEY.png",
	"InfoURL":"http://www.okchanger.ru/payment-systems/WEBMONEY",
	"PopularityPercent":5.09,
	"Currencies":[
		"WMB",
		"WME",
		"WMG",
		"WMR",
		"WMU",
		"WMX",
		"WMZ"
	]
},
{
	"ID":2,
	"Name":"Yandex",
	"PaySystemType":"OnlinePaySystem",
	"LogoURL":"http://www.okchanger.ru/assets/images/ps/YANDEX.png",
	"InfoURL":"http://www.okchanger.ru/payment-systems/YANDEX",
	"PopularityPercent":1.77,
	"Currencies":[
		"RUB"
	]
},
{
	"ID":3,
	"Name":"QIWI",
	"PaySystemType":"OnlinePaySystem",
	"LogoURL":"http://www.okchanger.ru/assets/images/ps/QIWI.png",
	"InfoURL":"http://www.okchanger.ru/payment-systems/QIWI",
	"PopularityPercent":2.71,
	"Currencies":[
		"KZT",
		"RUB",
		"USD"
	]
},
{
	"ID":4,
	"Name":"PayPal",
	"PaySystemType":"OnlinePaySystem",
	"LogoURL":"http://www.okchanger.ru/assets/images/ps/PAYPAL.png",
	"InfoURL":"http://www.okchanger.ru/payment-systems/PAYPAL",
	"PopularityPercent":11.85,
	"Currencies":[
		"EUR",
		"RUB",
		"USD"
	]
}
]
}

Функция Rating_Exchangers

[Array of Exchanger Objects]  Rating_Exchangers  Integer APIID, String signature, Integer paySystemID )

Эта функция предоставляет список обменников с подробной информацией, основанный на указанной платежной системы.

Параметры:

Название Тип Пример Описание
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature
paySystemID Integer 64 Payment system ID

Return value: Array of Exchanger Objects.

Пример ответа:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"ID":1214,
	"Name":"v-obmen.com",
	"LogoURL":"http://www.okchanger.ru/exchangers/preview-file/1214",
	"DescriptionText":null,
	"ReserveUSD":30692.7500,
	"InfoURL":"http://www.okchanger.ru/exchangers/v-obmen-com",
	"PositiveVotes":0,
	"NegativeVotes":0,
	"PopularityPercent":1.37,
	"PaySystems":[
		{
			"ID":1,
			"Name":"Webmoney",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/WEBMONEY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/WEBMONEY",
			"PopularityPercent":5.09,
			"Currencies":[
				"WMB",
				"WME",
				"WMG",
				"WMR",
				"WMU",
				"WMX",
				"WMZ"
			]
		},
		{
			"ID":2,
			"Name":"Yandex",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/YANDEX.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/YANDEX",
			"PopularityPercent":1.77,
			"Currencies":[
				"RUB"
			]
		},
		{
			"ID":3,
			"Name":"QIWI",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/QIWI.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/QIWI",
			"PopularityPercent":2.71,
			"Currencies":[
				"KZT",
				"RUB",
				"USD"
			]
		},
		{
			"ID":4,
			"Name":"PayPal",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PAYPAL.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PAYPAL",
			"PopularityPercent":11.85,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":5,
			"Name":"Perfect Money",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PERFECTMONEY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PERFECTMONEY",
			"PopularityPercent":10.79,
			"Currencies":[
				"BTC",
				"EUR",
				"USD"
			]
		},
		{
			"ID":6,
			"Name":"Skrill",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/SKRILL.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/SKRILL",
			"PopularityPercent":2.21,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":10,
			"Name":"OKPAY",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/OKPAY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/OKPAY",
			"PopularityPercent":48.74,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":12,
			"Name":"W1",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/W1.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/W1",
			"PopularityPercent":0.01,
			"Currencies":[
				"RUB",
				"UAH",
				"USD"
			]
		},
		{
			"ID":19,
			"Name":"SolidTrust Pay",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/SOLIDTRUSTPAY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/SOLIDTRUSTPAY",
			"PopularityPercent":0.43,
			"Currencies":[
				"USD"
			]
		},
		{
			"ID":20,
			"Name":"Payeer",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PAYEER.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PAYEER",
			"PopularityPercent":2.67,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":26,
			"Name":"Сбербанк",
			"PaySystemType":"OnlineBanking",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/SBERBANK.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/SBERBANK",
			"PopularityPercent":null,
			"Currencies":[
				"KZT",
				"RUB"
			]
		},
		{
			"ID":27,
			"Name":"Альфа-Клик",
			"PaySystemType":"OnlineBanking",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/ALFA-CLICK.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/ALFA-CLICK",
			"PopularityPercent":null,
			"Currencies":[
				"RUB",
				"USD"
			]
		},
		{
			"ID":32,
			"Name":"Тинькофф",
			"PaySystemType":"OnlineBanking",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/TINKOFF.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/TINKOFF",
			"PopularityPercent":null,
			"Currencies":[
				"RUB"
			]
		},
		{
			"ID":36,
			"Name":"Приват",
			"PaySystemType":"OnlineBanking",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PRIVAT.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PRIVAT",
			"PopularityPercent":null,
			"Currencies":[
				"UAH"
			]
		},
		{
			"ID":38,
			"Name":"Western Union",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/WESTERN UNION.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/WESTERN UNION",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":39,
			"Name":"Moneygram",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/MONEYGRAM.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/MONEYGRAM",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":40,
			"Name":"Contact",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/CONTACT.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/CONTACT",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"GBP",
				"RUB",
				"USD"
			]
		},
		{
			"ID":41,
			"Name":"Золотая Корона",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/ZOLOTAYAKORONA.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/ZOLOTAYAKORONA",
			"PopularityPercent":null,
			"Currencies":[
				"RUB",
				"USD"
			]
		},
		{
			"ID":42,
			"Name":"Cash",
			"PaySystemType":"Cash",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/CASH.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/CASH",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"GBP",
				"INR",
				"KZT",
				"MYR",
				"RUB",
				"SGD",
				"UAH",
				"USD"
			]
		},
		{
			"ID":43,
			"Name":"Cryptocurrencies",
			"PaySystemType":"CryptoCurrencies",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/CRYPTOCURRENCIES.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/CRYPTOCURRENCIES",
			"PopularityPercent":null,
			"Currencies":[
				"BTC",
				"DASH",
				"DOGE",
				"LTC"
			]
		},
		{
			"ID":49,
			"Name":"BTC-e",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/BTC-E.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/BTC-E",
			"PopularityPercent":1.91,
			"Currencies":[
				"BTC",
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":57,
			"Name":"AdvCash",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/ADVCASH.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/ADVCASH",
			"PopularityPercent":0.91,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":64,
			"Name":"Neteller",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/NETELLER.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/NETELLER",
			"PopularityPercent":7.56,
			"Currencies":[
				"EUR",
				"USD"
			]
		}
	]
},
{
	"ID":1276,
	"Name":"CambioSaldo",
	"LogoURL":"http://www.okchanger.ru/exchangers/preview-file/1276",
	"DescriptionText":null,
	"ReserveUSD":3985.6367,
	"InfoURL":"http://www.okchanger.ru/exchangers/cambiosaldo",
	"PositiveVotes":0,
	"NegativeVotes":0,
	"PopularityPercent":1.96,
	"PaySystems":[
		{
			"ID":4,
			"Name":"PayPal",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PAYPAL.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PAYPAL",
			"PopularityPercent":11.85,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":5,
			"Name":"Perfect Money",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/PERFECTMONEY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/PERFECTMONEY",
			"PopularityPercent":10.79,
			"Currencies":[
				"BTC",
				"EUR",
				"USD"
			]
		},
		{
			"ID":6,
			"Name":"Skrill",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/SKRILL.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/SKRILL",
			"PopularityPercent":2.21,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":10,
			"Name":"OKPAY",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/OKPAY.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/OKPAY",
			"PopularityPercent":48.74,
			"Currencies":[
				"EUR",
				"RUB",
				"USD"
			]
		},
		{
			"ID":38,
			"Name":"Western Union",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/WESTERN UNION.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/WESTERN UNION",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":39,
			"Name":"Moneygram",
			"PaySystemType":"MoneyTransfer",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/MONEYGRAM.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/MONEYGRAM",
			"PopularityPercent":null,
			"Currencies":[
				"EUR",
				"USD"
			]
		},
		{
			"ID":64,
			"Name":"Neteller",
			"PaySystemType":"OnlinePaySystem",
			"LogoURL":"http://www.okchanger.ru/assets/images/ps/NETELLER.png",
			"InfoURL":"http://www.okchanger.ru/payment-systems/NETELLER",
			"PopularityPercent":7.56,
			"Currencies":[
				"EUR",
				"USD"
			]
		}
	]
}
]
}

Функция Rating_Exchangers_Directions

[Array of ExchangersDirection Objects]  Rating_Exchangers_Directions  Integer APIID, String signature, Integer fromPaySystemID, String fromCurrencyName, Integer toPaySystemID, String toCurrencyName )

Эта функция предоставляет список обменников с обменными курсами на основе установленного направления обмена. Кроме того, рейтинг популярности для указанного направлении обмена среди пользователей OKchanger.

Параметры:

Название Тип Пример Описание
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature
fromPaySystemID Integer 10 Payment system ID (from)
fromCurrencyName String USD Currency code (from)
toPaySystemID Integer 10 Payment system ID (to)
toCurrencyName String EUR Currency code (to)

Return value: Array of ExchangersDirection Objects.

Пример ответа:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"ExchangerID":1197,
	"ExchangerName":"OK-Change",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1197",
	"DirectionRate":0.9040700000,
	"DirectionReserve":955.1900,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1197&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1239,
	"ExchangerName":"E-Money",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1239",
	"DirectionRate":0.8913768206,
	"DirectionReserve":114.0700,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1239&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1198,
	"ExchangerName":"F1Ex",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1198",
	"DirectionRate":0.9284700000,
	"DirectionReserve":29031.3200,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1198&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1281,
	"ExchangerName":"Changex.com",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1281",
	"DirectionRate":0.8910000000,
	"DirectionReserve":3061.4900,
	"MinFee":5.0000,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":8,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1281&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1254,
	"ExchangerName":"idealExchanger",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1254",
	"DirectionRate":0.9045830000,
	"DirectionReserve":850.0000,
	"MinFee":null,
	"ToFee":null,
	"FromFee":2.5000,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1254&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1217,
	"ExchangerName":"SuperChange.ru",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1217",
	"DirectionRate":0.8803591865,
	"DirectionReserve":73.8000,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1217&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1263,
	"ExchangerName":"Mobilexchange",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1263",
	"DirectionRate":0.9023804797,
	"DirectionReserve":1515.1600,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1263&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1208,
	"ExchangerName":"GOLDUX",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1208",
	"DirectionRate":0.9048320000,
	"DirectionReserve":850.0000,
	"MinFee":null,
	"ToFee":null,
	"FromFee":2.5000,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1208&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1499,
	"ExchangerName":"iGN Exchange",
	"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1499",
	"DirectionRate":0.9140200000,
	"DirectionReserve":0.2100,
	"MinFee":null,
	"ToFee":null,
	"FromFee":null,
	"IsManualExchange":false,
	"ExchangerPositiveVotes":0,
	"ExchangerNegativeVotes":0,
	"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1499&from=OKUSD&to=OKEUR"
}
]
}

Функция Rating_Directions_From

[Array of ExchangersDirectionInformation Objects]  Rating_Directions_From  Integer APIID, String signature, Integer fromPaySystemID, String fromCurrencyName )

Эта функция предоставляет список доступных направлений обменна (обмен С) для заданной платежной системы.

Параметры:

Название Тип Пример Описание
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature
fromPaySystemID Integer 10 Payment system ID (from)
fromCurrencyName String USD Currency code (from)

Return value: Array of ExchangersDirectionInformation Objects.

Пример ответа:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"DirectionPaySystem":{
		"ID":1,
		"Name":"Webmoney",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.ru/assets/images/ps/WEBMONEY.png",
		"InfoURL":"http://www.okchanger.ru/payment-systems/WEBMONEY",
		"PopularityPercent":5.09,
		"Currencies":[
			"WMB",
			"WME",
			"WMG",
			"WMR",
			"WMU",
			"WMX",
			"WMZ"
		]
	},
	"ExchangesByCurrency":[
		{
			"DirectionCurrency":"WMZ",
			"DirectionPopularityPercent":1.0126582278481012658227848101,
			"Rates":[
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1209,
					"ExchangerName":"TechnoCashier",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1209",
					"DirectionRate":0.9701000000,
					"DirectionReserve":100000.0000,
					"MinFee":7.0000,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1209&from=OKUSD&to=WMZ"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1280,
					"ExchangerName":"XaltChange",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1280",
					"DirectionRate":0.9830000000,
					"DirectionReserve":14349.1200,
					"MinFee":4.4400,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1280&from=OKUSD&to=WMZ"
				}
			]
		},
		{
			"DirectionCurrency":"WMR",
			"DirectionPopularityPercent":0,
			"Rates":[
				{
					"PaySystemID":1,
					"CurrencyName":"WMR",
					"ExchangerID":1280,
					"ExchangerName":"XaltChange",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1280",
					"DirectionRate":64.9462403274,
					"DirectionReserve":0.0100,
					"MinFee":4.4400,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1280&from=OKUSD&to=WMR"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMR",
					"ExchangerID":1214,
					"ExchangerName":"v-obmen.com",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1214",
					"DirectionRate":55.0000002475,
					"DirectionReserve":3121.0200,
					"MinFee":null,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1214&from=OKUSD&to=WMR"
				}
			]
		}
	]
},
{
	"DirectionPaySystem":{
		"ID":2,
		"Name":"Yandex",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.ru/assets/images/ps/YANDEX.png",
		"InfoURL":"http://www.okchanger.ru/payment-systems/YANDEX",
		"PopularityPercent":1.77,
		"Currencies":[
			"RUB"
		]
	},
	"ExchangesByCurrency":[
		{
			"DirectionCurrency":"RUB",
			"DirectionPopularityPercent":0,
			"Rates":[
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1334,
					"ExchangerName":"monetok.net",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1334",
					"DirectionRate":64.8522603898,
					"DirectionReserve":3447.8900,
					"MinFee":null,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1334&from=OKUSD&to=YAMRUB"
				},
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1230,
					"ExchangerName":"ALFAcashier",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1230",
					"DirectionRate":61.2176400417,
					"DirectionReserve":404416.3000,
					"MinFee":1.0000,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":false,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1230&from=OKUSD&to=YAMRUB"
				}
			]
		}
	]
}
]
}

Функция Rating_Directions_To

[Array of ExchangersDirectionInformation Objects]  Rating_Directions_To  Integer APIID, String signature, Integer toPaySystemID, String toCurrencyName )

Эта функция предоставляет список доступных направлений обменна (обмен НА) для заданной платежной системы.

Параметры:

Название Тип Пример Описание
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature
toPaySystemID Integer 10 Payment system ID (to)
toCurrencyName String EUR Currency code (to)

Return value: Array of ExchangersDirectionInformation Objects.

Пример ответа:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"DirectionPaySystem":{
		"ID":1,
		"Name":"Webmoney",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.ru/assets/images/ps/WEBMONEY.png",
		"InfoURL":"http://www.okchanger.ru/payment-systems/WEBMONEY",
		"PopularityPercent":5.09,
		"Currencies":[
			"WMB",
			"WME",
			"WMG",
			"WMR",
			"WMU",
			"WMX",
			"WMZ"
		]
	},
	"ExchangesByCurrency":[
		{
			"DirectionCurrency":"WMZ",
			"DirectionPopularityPercent":1.0126582278481012658227848101,
			"Rates":[
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1209,
					"ExchangerName":"TechnoCashier",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1209",
					"DirectionRate":0.9701000000,
					"DirectionReserve":100000.0000,
					"MinFee":7.0000,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1209&from=OKUSD&to=WMZ"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1280,
					"ExchangerName":"XaltChange",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1280",
					"DirectionRate":0.9830000000,
					"DirectionReserve":14349.1200,
					"MinFee":4.4400,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1280&from=OKUSD&to=WMZ"
				}
			]
		}
	]
},
{
	"DirectionPaySystem":{
		"ID":2,
		"Name":"Yandex",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.ru/assets/images/ps/YANDEX.png",
		"InfoURL":"http://www.okchanger.ru/payment-systems/YANDEX",
		"PopularityPercent":1.77,
		"Currencies":[
			"RUB"
		]
	},
	"ExchangesByCurrency":[
		{
			"DirectionCurrency":"RUB",
			"DirectionPopularityPercent":0,
			"Rates":[
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1334,
					"ExchangerName":"monetok.net",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1334",
					"DirectionRate":64.8522603898,
					"DirectionReserve":3447.8900,
					"MinFee":null,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":true,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1334&from=OKUSD&to=YAMRUB"
				},
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1230,
					"ExchangerName":"ALFAcashier",
					"ExchangerLogoURL":"http://www.okchanger.ru/exchangers/preview-file/1230",
					"DirectionRate":61.2176400417,
					"DirectionReserve":404416.3000,
					"MinFee":1.0000,
					"ToFee":null,
					"FromFee":null,
					"IsManualExchange":false,
					"ExchangerPositiveVotes":0,
					"ExchangerNegativeVotes":0,
					"ExchangeProcessURL":"http://www.okchanger.ru/away?sType=1&sId=1230&from=OKUSD&to=YAMRUB"
				}
			]
		}
	]
}
]
}

Коды ошибок API

Код ошибки Описание
API_Wrong_Hash Некорректная подпись запроса. Проверьте порядок параметров и числовой формат
Parameter_Validation_Error Некорректный параметр (null, empty или negative)

Структура данных

Object PaySystem

Название Тип Пример Описание
ID Integer 10 Payment system ID
Name String "OKPAY", "Webmoney", etc. Payment system name
PaySystemType String OnlinePaySystem Payment system type
LogoURL String http://www.okchanger.ru/.../okpay.png Payment system logo URL
InfoURL String http://www.okchanger.ru/.../okpay Payment system details URL
PopularityPercent Decimal 54.99, 22.87 Payment system popularity
Currencies Array(string Currency) ["USD", "EUR", etc.] ISO currency codes

Object Exchanger

Название Тип Пример Описание
ID Integer 10 Exchanger ID
Name String "CambioSaldo", "Magnetic Exchange", etc. Exchanger name
LogoURL String http://www.okchanger.ru/.../1198 Exchanger logo URL
DescriptionText String "Lorem ipsum dolor sit amet..." Exchanger description
ReserveUSD Decimal 1234.56, 789.10, etc. Exchanger reserve in USD
InfoURL String http://www.okchanger.ru/.../f1ex Exchanger details URL
PositiveVotes Integer 1, 10, 15, etc. Number of positive exchanger reviews
NegativeVotes Integer 1, 10, 15, etc. Number of negative exchanger reviews
PopularityPercent Decimal 2.18, 33.11, 15.00, etc. Exchanger popularity
PaySystems Array(PaySystem) Supported payment systems

Object ExchangersDirection

Название Тип Пример Описание
ExchangerID Integer 10 Exchanger ID
ExchangerName String "F1ex", "OK-Change", etc. Exchanger name
ExchangerLogoURL String http://www.okchanger.ru/.../1197 Payment system logo URL
DirectionRate Decimal 0.9040900000 Exchange rate for certain direction
DirectionReserve Decimal 955.1800, etc. Exchanger reserve in base currency
MinFee String 5 USD Minimal commission fee charged by the exchanger for the exchange of the given currency pair
ToFee String 2 EUR Extra commission fee that is added to the exchange rate and is deducted from the amount the exchanger transfers to the customer
FromFee String 2.15 EUR Extra commission fee that is added to the exchange rate and is deducted from the amount the customer transfers to the exchanger
IsManualExchange Boolean true/false Parameter is true for all non-automatic, non-instant exchange directions (for manual, operator-controlled, etc.).
ExchangerPositiveVotes Integer 1, 10, 15, etc. Number of positive exchanger reviews
ExchangerNegativeVotes Integer 1, 10, 15, etc. Number of negative exchanger reviews
ExchangeProcessURL String http://www.okchanger.ru/away?sType=1&sId=1197&from=OKUSD&to=OKEUR URL to perform exchange operation

Object ExchangersDirectionInformation

Название Тип Пример Описание
DirectionPaySystem PaySystem Payment system information
ExchangesByCurrency Array(ExchangeInformation) Detailed information about exchange directions

Object ExchangeInformation

Название Тип Пример Описание
DirectionCurrency String "USD", "EUR", etc. Exchange direction currency code
DirectionPopularityPercent Decimal 1.25, 18.90, etc. Exchange direction popularity
Rates Array(Rate) Existing rates

Object Rate

Название Тип Пример Описание
PaySystemID Integer 1, 10, 15, etc. Payment system ID
CurrencyName String "USD", "EUR", etc. Currency ISO code
ExchangerID Integer 10 Exchanger ID
ExchangerName String "F1ex", "OK-Change", etc. Exchanger name
ExchangerLogoURL String http://www.okchanger.ru/.../1197 Payment system logo URL
DirectionRate Decimal 0.9040900000 Exchange rate for certain direction
DirectionReserve Decimal 955.1800, etc. Exchanger reserve in base currency
MinFee String 5 USD Minimal commission fee charged by the exchanger for the exchange of the given currency pair
ToFee String 2 EUR Extra commission fee that is added to the exchange rate and is deducted from the amount the exchanger transfers to the customer
FromFee String 2.15 EUR Extra commission fee that is added to the exchange rate and is deducted from the amount the customer transfers to the exchanger
IsManualExchange Boolean true/false Parameter is true for all non-automatic, non-instant exchange directions (for manual, operator-controlled, etc.).
ExchangerPositiveVotes Integer 1, 10, 15, etc. Number of positive exchanger reviews
ExchangerNegativeVotes Integer 1, 10, 15, etc. Number of negative exchanger reviews
ExchangeProcessURL String http://www.okchanger.ru/away?sType=1&sId=1197&from=OKUSD&to=OKEUR URL to perform exchange operation

 

Справочник

Коды платежных систем

ID Название ID Название ID Название
1Webmoney2Yandex3QIWI
4PayPal5Perfect Money6Skrill
7Payza8EasyPay9EgoPay
10OKPAY11LiqPay12W1
13Paxum14ePayments15Pecunix
16C-Gold17PayWeb18Ukash
19SolidTrust Pay20Payeer21NixMoney
22RBK Money23Z-Payment24Деньги@mail.ru
25Liberty Reserve26Сбербанк27Альфа-Клик
28Связной Банк29ВТБ2430Русский Стандарт
31Авангард32Тинькофф33Промсвязьбанк
34Открытие35Кукуруза36Приват
37Дельтабанк38Western Union39Moneygram
40Contact41Золотая Корона42Cash
43Cryptocurrencies44Visa/Mastercard45Bank Wire
46HalykBank47Казкоммерцбанк48Альянс Банк
49BTC-e50OOOPay51Газпромбанк
52Бинбанк53LavaPay54MoneyPolo
55SEPA56Sofort57AdvCash
58FasaPay59Unistream60PexPay
61РНКБ64Neteller65RedPass
66Траст67Райффайзен68eCoin.eu
69WebTransfer70Хоум Кредит74EXMO
75ForteBank76HelixMoney77PaySera
78ПУМБ79AliPay80UnionPay
81Idram82Paymer83AstroPay
84Coinmate85Epay86Ощадбанк
87Беларусбанк88eCoin.cc89Epese
90Capitalist91Payoneer92PaySafeCard
93WebSum94Bitport95Tether
96Unicredit97Forward Bank98Livecoin Code
99Уралсиб100Flexepin101Ria Money Transfer
102Bank of China103Perfect Money Voucher104QIWI Voucher
105Phone Balance106MTS Balance107Megafon Balance
108Beeline Balance

 

Примеры кода

PHP
 <?php  /**  *  * API-call related functions  *  */    class OkChangerAPI {   protected $public_api = 'http://www.okchanger.com/API/';   protected $api_id;   protected $api_key;   public $PaymentSystems = array();     public function __construct($api_id, $api_key) {   $this->api_id = $api_id;   $this->api_key = $api_key;     // Init payment systems   $this->RefreshPaymentSystems();   }     /**   * Call the API   */   public function Query($method = '', $args = array()) {   // Prepare request before send   $this->Prepare($args);   print_r($args);   $url = $this->public_api.$method;   $ch = curl_init();   if(strtolower((substr($url,0,5))=='https')) {   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);   }   curl_setopt($ch, CURLOPT_URL, $url);   curl_setopt($ch, CURLOPT_REFERER, $url);   curl_setopt($ch, CURLOPT_VERBOSE, 0);   curl_setopt($ch, CURLOPT_POST, 0);   #curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);   curl_setopt($ch, CURLOPT_POSTFIELDS, $args);   curl_setopt($ch, CURLOPT_USERAGENT,   "Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4");   curl_setopt($ch, CURLOPT_HEADER, 0);   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);   curl_setopt($ch, CURLOPT_TIMEOUT, 10);   $result = curl_exec($ch);   curl_close($ch);   print_r($result.PHP_EOL);   return json_decode($result);   }     /**   * Prepare request   */   private function Prepare(&$Params) {   // Sort array by key (ASC)   if(isset($Params['signature'])) {   unset($Params['signature']);   }     $Params = array_reverse($Params, true);   $Params['APIID'] = $this->api_id;   $Params = array_reverse($Params, true);     $SortedParams = array();   $a1 = array_keys($Params);   foreach($a1 as $key) {   $SortedParams[strtolower($key)] = $Params[$key];   }   ksort($SortedParams);     // Implode values and append API key   $Imploded = implode(":", $SortedParams).":".$this->api_key;     $SortedParams['signature'] = md5($Imploded);   $Params = $SortedParams;   }     /**   * Refresh payment systems collection   */   public function RefreshPaymentSystems() {   $PaySystemsResult = $this->Query("Rating_PaySystems");   if($PaySystemsResult->IsSuccess) {   $this->PaymentSystems = array();   foreach($PaySystemsResult->Result as $PaySystem) {   $this->PaymentSystems[$PaySystem->ID] = $PaySystem;   }   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$PaySystemsResult->ErrorMessage);   }   }     /**   * Get payment systems list   */   public function Rating_PaySystems() {   $PaySystemsResult = $this->Query("Rating_PaySystems");   if($PaySystemsResult->IsSuccess) {   return $PaySystemsResult->Result;   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$CurrencyResult->ErrorMessage);   }   }     /**   * Get exchangers list   */   public function Rating_Exchangers($PaySystemID) {   if(!array_key_exists($PaySystemID, $this->PaymentSystems)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Payment system '.$PaySystemID.' not found');   }   $ExchangersResult = $this->Query("Rating_Exchangers", array('paySystemID' => $PaySystemID));   if($ExchangersResult->IsSuccess) {   return $ExchangersResult->Result;   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$ExchangersResult->ErrorMessage);   }   }     /**   * Get available directions   */   public function Rating_Exchangers_Directions($FromPaySystemID, $FromCurrencyName, $ToPaySystemID, $ToCurrencyName) {   if(!array_key_exists($FromPaySystemID, $this->PaymentSystems)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Payment system '.$PaySystemID.' not found');   }   if(!array_key_exists($ToPaySystemID, $this->PaymentSystems)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Payment system '.$ToPaySystemID.' not found');   }     if(!in_array($FromCurrencyName, $this->PaymentSystems[$FromPaySystemID]->Currencies)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Currency '.$FromCurrencyName.' not found in '.$this->PaymentSystems[$FromPaySystemID]->Name.' payment system');   }   if(!in_array($ToCurrencyName, $this->PaymentSystems[$ToPaySystemID]->Currencies)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Currency '.$ToCurrencyName.' not found in '.$this->PaymentSystems[$FromPaySystemID]->Name.' payment system');   }     $DirectionsResult =   $this->Query(   "Rating_Exchangers_Directions",   array(   'fromPaySystemID' => $FromPaySystemID,   'fromCurrencyName' => $FromCurrencyName,   'toPaySystemID' => $ToPaySystemID,   'toCurrencyName' => $ToCurrencyName   )   );   if($DirectionsResult->IsSuccess) {   return $DirectionsResult->Result;   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$DirectionsResult->ErrorMessage);   }   }     /**   * Get available directions by payment system and currency code (FROM)   */   public function Rating_Directions_From($FromPaySystemID, $FromCurrencyName) {   if(!array_key_exists($FromPaySystemID, $this->PaymentSystems)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Payment system '.$FromPaySystemID.' not found');   }   if(!in_array($FromCurrencyName, $this->PaymentSystems[$FromPaySystemID]->Currencies)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Currency '.$FromCurrencyName.' not found in '.$this->PaymentSystems[$FromPaySystemID]->Name.' payment system');   }   $DirectionsResult =   $this->Query(   "Rating_Directions_From",   array(   'fromPaySystemID' => $FromPaySystemID,   'fromCurrencyName' => $FromCurrencyName   )   );   if($DirectionsResult->IsSuccess) {   return $DirectionsResult->Result;   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$DirectionsResult->ErrorMessage);   }   }     /**   * Get available directions by payment system and currency code (TO)   */   public function Rating_Directions_To($ToPaySystemID, $ToCurrencyName) {   if(!array_key_exists($ToPaySystemID, $this->PaymentSystems)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Payment system '.$ToPaySystemID.' not found');   }   if(!in_array($ToCurrencyName, $this->PaymentSystems[$ToPaySystemID]->Currencies)) {   throw new OkChangerAPIInvalidParameterException('File: '.__FILE__.' Line: '.__LINE__.' Error: Currency '.$ToCurrencyName.' not found in '.$this->PaymentSystems[$FromPaySystemID]->Name.' payment system');   }   $DirectionsResult =   $this->Query(   "Rating_Directions_To",   array(   'toPaySystemID' => $ToPaySystemID,   'toCurrencyName' => $ToCurrencyName   )   );   if($DirectionsResult->IsSuccess) {   return $DirectionsResult->Result;   } else {   throw new OkChangerAPIFailureException('File: '.__FILE__.' Line: '.__LINE__.' API Error: '.$DirectionsResult->ErrorMessage);   }   }  }    /**   * Exceptions  */  class OkChangerAPIException extends Exception {}  class OkChangerAPIFailureException extends OkChangerAPIException {}  class OkChangerAPIInvalidParameterException extends OkChangerAPIException {}  ?>
C#
 using System;  using System.Collections.Generic;  using System.Linq;  using System.Text;  using System.Threading.Tasks;  using System.Net;  using System.IO;  using System.Security.Cryptography;  using System.Security.Cryptography.X509Certificates;  using System.Net.Security;  using Newtonsoft.Json;  using System.Web; //Add reference to System.Web  using Newtonsoft.Json.Linq; //"Manage NuGet packages" -> Search for "newtonsoft json". -> click "install".  namespace OkChanger  {   /*   {   var method = new OkChanger.API.MethodCall(OkChanger.API.API_Methods.Rating_PaySystems, 21241, "API_KEY_HERE");   method.Execute();   //Console.WriteLine(method.Result.ToString());   }     {   var method = new OkChanger.API.MethodCall(OkChanger.API.API_Methods.Rating_Exchangers, 21241, "API_KEY_HERE");   //method.AddParameter("paySystemID", 10);//OKPAY   method.AddParameter("paySystemID", 0);//ALL Exhangers   method.Execute();   //Console.WriteLine(method.Result.ToString());   }     {   var method = new OkChanger.API.MethodCall(OkChanger.API.API_Methods.Rating_Exchangers_Directions, 21241, "API_KEY_HERE");   method.AddParameter("fromPaySystemID", 10);//OKPAY   method.AddParameter("fromCurrencyName", "USD");   method.AddParameter("toPaySystemID", 10);//OKPAY   method.AddParameter("toCurrencyName", "EUR");   method.Execute();   //Console.WriteLine(method.Result.ToString());   }     {   var method = new OkChanger.API.MethodCall(OkChanger.API.API_Methods.Rating_Directions_From, 21241, "API_KEY_HERE");   method.AddParameter("fromPaySystemID", 10);//OKPAY   method.AddParameter("fromCurrencyName", "USD");   method.Execute();   //Console.WriteLine(method.Result.ToString());   }     {   var method = new OkChanger.API.MethodCall(OkChanger.API.API_Methods.Rating_Directions_To, 21241, "API_KEY_HERE");   method.AddParameter("toPaySystemID", 10);//OKPAY   method.AddParameter("toCurrencyName", "USD");   method.Execute();   //Console.WriteLine(method.Result.ToString());   }   */   public class API   {     public enum API_Methods   {   Rating_PaySystems,   Rating_Exchangers_Directions,   Rating_Exchangers,   Rating_Directions_From,   Rating_Directions_To,   }     public class MethodCall   {   const string APIURL = @"https://www.OkChanger.com/API/";     public long? APIID { get; set; }   public string APIKey { get; set; }   public string MethodName { get; set; }   public JToken Result { get; private set; }   private Dictionary<string, string> Parameters = new Dictionary<string, string>();     public MethodCall(API_Methods method, long? APIID = null, string APIKey = null) : this(method.ToString(), APIID, APIKey) { }   public MethodCall(string methodName, long? APIID = null, string APIKey = null)   {   this.MethodName = methodName;   this.APIID = APIID;   this.APIKey = APIKey;     if (this.APIID.HasValue)   {   this.AddParameter("APIID", APIID);   }   }     public void AddParameter(string name, object value)   {   Parameters.Add(name, value.ToString());   }     public void AddParameter(string name, long value)   {   Parameters.Add(name, value.ToString());   }       public void AddParameter(string name, int value)   {   Parameters.Add(name, value.ToString());   }     public void AddParameter(string name, short value)   {   Parameters.Add(name, value.ToString());   }     public void AddParameter(string name, byte value)   {   Parameters.Add(name, value.ToString());   }     public void AddParameter(string name, float value)   {   Parameters.Add(name, value.ToString("0.00000000", System.Globalization.CultureInfo.InvariantCulture.NumberFormat));   }     public void AddParameter(string name, decimal value)   {   Parameters.Add(name, value.ToString("0.00000000", System.Globalization.CultureInfo.InvariantCulture.NumberFormat));   }     public void Execute()   {     var tmpParameters = this.Parameters.ToDictionary(c => c.Key, c => c.Value);   var values = tmpParameters.OrderBy(c => c.Key).Select(c => c.Value).ToList();   if (!string.IsNullOrEmpty(this.APIKey))   {   values.Add(this.APIKey);   var original = string.Join(":", values);   tmpParameters.Add("signature", API.GetMd5Hash(original));   }   string url = APIURL + MethodName + "?" + string.Join("&", tmpParameters.Select(c => HttpUtility.UrlEncode(c.Key) + "=" + HttpUtility.UrlEncode(c.Value)));   string result = null;   try   {   using (WebClient wc = new WebClient())   {   wc.Encoding = System.Text.UTF8Encoding.UTF8;  #if DEBUG   System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();   sw.Start();  #endif   result = wc.DownloadString(url);  #if DEBUG   sw.Stop();   Console.WriteLine("API Call Method: {0}, {1} ms", MethodName, sw.ElapsedMilliseconds);  #endif   }   }   catch   {   throw new OkChangerAPIConnectionException();   }   JObject jObj;   string errorMessage;   try   {   jObj = JObject.Parse(result);   errorMessage = (string)jObj["ErrorMessage"];   }   catch   {   throw new OkChangerAPIInvalidAnswerException();   }   if (!string.IsNullOrEmpty(errorMessage))   {   throw new OkChangerAPIException(errorMessage);   }   this.Result = jObj["Result"];       }     }       internal static string GetMd5Hash(string input)   {   using (var md5 = System.Security.Cryptography.MD5.Create())   {   var arr = System.Text.Encoding.ASCII.GetBytes(input);   arr = md5.ComputeHash(arr);   return BitConverter.ToString(arr).Replace("-", "");   }   }   }     public class OkChangerAPIConnectionException : Exception   {     }   public class OkChangerAPIInvalidAnswerException : Exception   {     }     public class OkChangerAPIException : Exception   {   public OkChangerAPIException(string message)   : base(message)   {   }   }    }