Here, you’ll find all the essential information on how to correctly authenticate your API requests.
HTTP Basic Authentication
Our API uses the HTTP Basic Authentication method. Your API Keys— Shop ID and Shop Secret Key(seen in our API Reference as username and password) —will be provided via email by our technical support team after you complete your PayRetailers sign-up. If you have not signed up for a merchant account with PayRetailers yet, you can do that on this link.
To authenticate your request, please include the authorization information in the Authorization
header of your HTTP request. The value of the Authorization
header must contain the word "Basic" followed by a space and your credentials encoded in Base64 format.
Before you base64 encode your credentials, you will have to combine your Shop ID and Secret Key, concatenated by a colon in this format: shopId:secretKey
Example
--header 'Authorization: Basic MTIzNDpwbGVhc2ZWHqp89yZGluZ3RveW91bnRpYWxzdGhpc2lzYWR1bW15c3RyaW5ndG9lbmNvZGV0aGFua3lvdWJ5ZQ=='
Authorization: Basic MTIzNDpwbGZ2VtZWHqp89yZGluZ3RveW91bnRpYWxzdGhpc2lzYWR1bW15c3RyaW5ndG9lbmNvZGV0aGFua3lvdWJ5ZQ==
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic MTIzNDpwbGVhc229yZGluZ3RveW91cmNyZWRlbnRpYWxzdGhpc2lzYWR1bW15c3RyaW5ndG9lbmNvZGV0aGFua3lvdWJ5ZQ==");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.gateway.payretailers.com/v2/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
If your authorization key is incorrect, you will receive a 401 error in response to your request.
Subscription key
The PayRetailers API enforces a strict IP-based origin restriction for API requests, for the purpose of which we require that you send an additional header, called Ocp-Apim-Subscription-Key
for each request that you make to the API.
The header should contain a unique subscription key, which is assigned to your account when it was created. You should receive the subscription key via email after you complete your PayRetailers sign-up.
Example
--header 'Ocp-Apim-Subscription-Key: 1aa4e605bd5b405fba6061b55e52f4cd'
Ocp-Apim-Subscription-Key: 1aa4e605bd5b405fba6061b55e52f4cd
var myHeaders = new Headers();
myHeaders.append("Ocp-Apim-Subscription-Key", "1aa4e605bd5b405fba6061b55e52f4cd");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.gateway.payretailers.com/v2/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
If your subscription key is incorrect, you will receive a 401 error in response to your request.
HTTP 401 ErrorThe HTTP 401 error may also be triggered if the IP address from which your system is sending the API request is not allowed access. If you encounter an HTTP 401 error when attempting API requests, please contact our technical support team at [email protected] for further assistance.