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 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
IMPORTANTThis parameter has become optional: it is no longer necessary to include it in the API header. If your integration is already sending it, there's no issue in continuing to do so; otherwise, it can be safely omitted.
The PayRetailers API uses an API Key and IP-based origin restriction to validate requests. The Ocp-Apim-Subscription-Key header was previously required alongside this validation and issued automatically when an account was created. This is no longer the case: new accounts are not issued a subscription key, and this header is not required for your requests to work.
If your integration already has a subscription key from a previous setup, you can keep sending it — it will continue to work with no impact on your requests.
Example
--header 'Ocp-Apim-Subscription-Key: 1aa4e605bd5b405fba6061b55e52f4cd'Ocp-Apim-Subscription-Key: 1aa4e605bd5b405fba6061b55e52f4cdvar 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));Note: This header is no longer validated, whether you send it or not.
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.