Integration Guide for Payment Service Providers

Getting Started

OKchanger application programming interface (API) allows our clients to automatically access information about available exchange directions, exchangers and payment systems listed on the OKchanger monitoring platform. This functionality can be used for providing your users with additional methods of funding their accounts in your service.

In order to use the API, you need to create an API Key in your OKchanger profile.

API Key Setup

Before using API functions, you need to set up an API Key in your OKchanger profile in the API Keys section. This Key will be used for authorization allowing functions usage.

Important! For security purposes you can create several API Keys. Each API key can be configured in a special way to allow access only to certain functions.

To create a new API Key, click on the appropriate link on the API Keys page. Another page will pop up where you need to choose a name for the API Key, and set a password. Moreover, you'll have to select those functions that you plan to use with that API Key. Click Save to obtain an API Key ID. It will be shown on the Existing API Keys List below the ID column. The API Key ID as well as the API Key Password will be needed later for accessing API functions.

Authorization Scheme

All API functions require a special signature which is generated from the values of variables that are sent to the function and are sorted by variables' names in ascending order + API password, separated by colons (:).

For example, if a function with the following parameters is being accessed:

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

First of all, we will put all of the names of function parameters in alphabetical order (Important!):

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

Assuming that your API Key Password is ‘AABBCC’ (in accordance with your account settings). Then we get the md5 hash of the following string:

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

The result of the md5 function is:

signature = ‘8bfea2057de0ddb965a8b4a7db877abf’

Now having filled the signature variable, you are ready to access protected function Rating_Directions_From as shown above.

Making API Request

All API requests need authentication. You can find out more on authentication in the section above (see Authorization Scheme above).

All requests need to be sent to the following URL:
https://www.okchanger.com/API/Rating_PaySystems?apiid=21238&signature=c0f99c53ed30b0365bc7f7888eb8db53

Where: Rating_PaySystems — Name of called function
               ?apiid=21238&signature=c0f99c53ed30b0365bc7f7888eb8db53 — Request parametres

Parameters can be sent both with POST or GET methods.

Response Example:

{
	"ErrorMessage":" ... error message if occured ... ",
	"IsSuccess":"1",
	"Result":" ... some data ... "
}
Name Type Example Description
ErrorMessage String API_Wrong_Hash Error code
IsSuccess Boolean true Operation success
Result Array/Object   Result

API Functions

Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application. JSON is returned by all API responses, including errors, although our API libraries convert responses to appropriate language-specific objects.

Available list of API functions is listed below. Each of them is used for a certain purpose.


Below we will describe each function in more detail.

Rating_PaySystems Function

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

This function provides detailed information on the payment systems engaged in available exchange directions.

Parameters:

Name Type Example Description
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature

Return value: Array of PaySystem Objects.

Response example:

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

Rating_Exchangers Function

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

This function provides the list of exchangers with detailed information based on the specified supported payment system.

Parameters:

Name Type Example Description
APIID Integer 21238 API Key ID
signature String 8bfea2057de0ddb965a8b4a7db877abf MD5 Request Signature
paySystemID Integer 64 Payment system ID

Return value: Array of Exchanger Objects.

Response example:

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

Rating_Exchangers_Directions Function

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

This function provides the list of exchangers with exchange rates based on the set exchange direction. Additionally, the popularity ratings for the specified exchange direction among OKchanger users.

Parameters:

Name Type Example Description
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.

Response example:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"ExchangerID":1197,
	"ExchangerName":"OK-Change",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1197&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1239,
	"ExchangerName":"E-Money",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1239&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1198,
	"ExchangerName":"F1Ex",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1198&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1281,
	"ExchangerName":"Changex.com",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1281&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1254,
	"ExchangerName":"idealExchanger",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1254&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1217,
	"ExchangerName":"SuperChange.ru",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1217&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1263,
	"ExchangerName":"Mobilexchange",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1263&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1208,
	"ExchangerName":"GOLDUX",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1208&from=OKUSD&to=OKEUR"
},
{
	"ExchangerID":1499,
	"ExchangerName":"iGN Exchange",
	"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1499&from=OKUSD&to=OKEUR"
}
]
}

Rating_Directions_From Function

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

This function provides the list of available exchange directions (exchange from) for the specified payment system.

Parameters:

Name Type Example Description
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.

Response example:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"DirectionPaySystem":{
		"ID":1,
		"Name":"Webmoney",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.com/assets/images/ps/WEBMONEY.png",
		"InfoURL":"http://www.okchanger.com/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.com/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.com/away?sType=1&sId=1209&from=OKUSD&to=WMZ"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1280,
					"ExchangerName":"XaltChange",
					"ExchangerLogoURL":"http://www.okchanger.com/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.com/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.com/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.com/away?sType=1&sId=1280&from=OKUSD&to=WMR"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMR",
					"ExchangerID":1214,
					"ExchangerName":"v-obmen.com",
					"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1214&from=OKUSD&to=WMR"
				}
			]
		}
	]
},
{
	"DirectionPaySystem":{
		"ID":2,
		"Name":"Yandex",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.com/assets/images/ps/YANDEX.png",
		"InfoURL":"http://www.okchanger.com/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.com/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.com/away?sType=1&sId=1334&from=OKUSD&to=YAMRUB"
				},
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1230,
					"ExchangerName":"ALFAcashier",
					"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1230&from=OKUSD&to=YAMRUB"
				}
			]
		}
	]
}
]
}

Rating_Directions_To Function

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

This function provides the list of available exchange directions (exchange to) for the specified payment system.

Parameters:

Name Type Example Description
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.

Response example:

{
"ErrorMessage":null,
"IsSuccess":true,
"Result":[
{
	"DirectionPaySystem":{
		"ID":1,
		"Name":"Webmoney",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.com/assets/images/ps/WEBMONEY.png",
		"InfoURL":"http://www.okchanger.com/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.com/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.com/away?sType=1&sId=1209&from=OKUSD&to=WMZ"
				},
				{
					"PaySystemID":1,
					"CurrencyName":"WMZ",
					"ExchangerID":1280,
					"ExchangerName":"XaltChange",
					"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1280&from=OKUSD&to=WMZ"
				}
			]
		}
	]
},
{
	"DirectionPaySystem":{
		"ID":2,
		"Name":"Yandex",
		"PaySystemType":"OnlinePaySystem",
		"LogoURL":"http://www.okchanger.com/assets/images/ps/YANDEX.png",
		"InfoURL":"http://www.okchanger.com/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.com/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.com/away?sType=1&sId=1334&from=OKUSD&to=YAMRUB"
				},
				{
					"PaySystemID":2,
					"CurrencyName":"RUB",
					"ExchangerID":1230,
					"ExchangerName":"ALFAcashier",
					"ExchangerLogoURL":"http://www.okchanger.com/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.com/away?sType=1&sId=1230&from=OKUSD&to=YAMRUB"
				}
			]
		}
	]
}
]
}

Error Codes

Error Code Description
API_Wrong_Hash Wrong request signature. Check parameters order and number format
Parameter_Validation_Error Invalid parameter (null, empty or negative)

Data Structures

Object PaySystem

Name Type Example Description
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.com/.../okpay.png Payment system logo URL
InfoURL String http://www.okchanger.com/.../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

Name Type Example Description
ID Integer 10 Exchanger ID
Name String "CambioSaldo", "Magnetic Exchange", etc. Exchanger name
LogoURL String http://www.okchanger.com/.../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.com/.../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

Name Type Example Description
ExchangerID Integer 10 Exchanger ID
ExchangerName String "F1ex", "OK-Change", etc. Exchanger name
ExchangerLogoURL String http://www.okchanger.com/.../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.com/away?sType=1&sId=1197&from=OKUSD&to=OKEUR URL to perform exchange operation

Object ExchangersDirectionInformation

Name Type Example Description
DirectionPaySystem PaySystem Payment system information
ExchangesByCurrency Array(ExchangeInformation) Detailed information about exchange directions

Object ExchangeInformation

Name Type Example Description
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

Name Type Example Description
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.com/.../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.com/away?sType=1&sId=1197&from=OKUSD&to=OKEUR URL to perform exchange operation

 

References

Payment systems codes

ID Title ID Title ID Title
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Альянс Банк
49WEX50OOOPay51Газпромбанк
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

 

Code Samples

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)   {   }   }    }