For developers
By Qliro
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
{ "MerchantReference": "MerchantUniqueReference", "Currency": "SEK", "Country": "SE", "Language": "sv-se", "MerchantConfirmationUrl": "http://Merchant.com/confirmation/", "MerchantTermsUrl": "http://Merchant.com/terms/", "PrimaryColor": "#00FF00", "CallToActionColor": "#0000FF", "OrderItems": [ { "MerchantReference": "XXX", "Description": "ZZZ", "Quantity": 4, "PricePerItemIncVat": 450, "PricePerItemExVat": 450 } ], "MerchantApiKey": "MERCHANTKEY" }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
var generateToken = function () { var payload = request.data; console.log("Payload: ", payload); var secret = postman.getEnvironmentVariable("ApiSecret"); console.log("Secret: ", secret); var input = ''; if (payload && Object.keys(payload).length > 0) { input += payload; } input += secret; console.log("Input: ", input); var token = CryptoJS.SHA256(input).toString(CryptoJS.enc.Base64); console.log("Token: ", token); return "Qliro " + token; };
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
public string CreateAuthorizationToken(string jsonPayoload, string apiSecret) { using (var algorithm = new SHA256Managed()) { var data = jsonPayload + apisecret; var bytes = Encoding.UTF8.GetBytes(data); var hash = algorithm.ComputeHash(bytes); return string.Format("Qliro {0}", Convert.ToBase64String(hash)); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
$json = json_encode(array ( 'MerchantReference' => 'MerchantUniqueReference', 'Currency' => 'SEK', 'Country' => 'SE', 'Language' => 'sv-se', 'MerchantConfirmationUrl' => 'http://Merchant.com/confirmation/', 'MerchantTermsUrl' => 'http://Merchant.com/terms/', 'PrimaryColor' => '#00FF00', 'CallToActionColor' => '#0000FF', 'OrderItems' => array ( 0 => array ( 'MerchantReference' => 'XXX', 'Description' => 'ZZZ', 'Quantity' => 4, 'PricePerItemIncVat' => 450, 'PricePerItemExVat' => 450, ), ), 'MerchantApiKey' => 'API-KEY', ));print $json; echo "<br>"; echo "Authentication Header = <br>"; print 'Qliro '.base64_encode(hex2bin(hash('sha256', $json.'<API-SECRET>')));
Name | Type | Description |
ErrorCode | String | Unique error code |
ErrorMessage | String | Detailed error message |
ErrorReference | String | A tracking ID from Qliro Checkout |
1
2
3
4
5
{
"ErrorCode": "SYSTEM_ERROR",
"ErrorMesssage": "Details about the error",
"ErrorReference": "GUID-CorelationId"
}