Checksum Examples

Test environment Checksum example

The following example is for the Test environment, therefore the endpoint should be set to https://acc-interconnect.icepay.com/api/contract/authorisation

POST https://acc-interconnect.icepay.com/api/contract/authorisation

UserId
string
User identity value to specify in headers (also known as ContractProfileId)
Example value: B4980F36-K45K-4DBF-BF6E-DG3941B2TG83
Secret
string
Secret for the contract profile
Example value: hJ8nnHU7yLRzgHpEGoecnQrcOs5bTv3u35yPKTrWnnQ=
Payload
object

Example of the payload?{"Contract": {"ContractProfileId": "B4980F36-K45K-4DBF-BF6E-DG3941B2TG83"AmountInCents": 100,"CurrencyCode": "EUR","Reference": "kx7ypcrygxe"},"Fulfillment": {"PaymentMethod": "AFTERPAY","IssuerCode": "AFTERPAY","AmountInCents": 100,"CurrencyCode": "EUR","Reference": "kx7ypcrygxe","FreeFormatData": null,"Consumer": null,"DeliveryConsumer": null,"Order": null,"Timestamp": "2018-11-21T13:27:36.2690603Z","LanguageCode": "nl","Description": "Order: kx7ypcrygxe"},"Postback": {"UrlCompleted": "https://acc-interconnect.icepay.com/demo/FinalizeSuccessful","UrlError": "https://acc-interconnect.icepay.com/demo/FinalizeWithError","UrlsNotify": ["https://acc-interconnect.icepay.com/demo/api/Payment/Notify"]},"IntegratorFootprint": null,"ConsumerFootprint": {"IPAddress": "10.244.1.217","Browser": "Chrome 70.0.3538.102","OperatingSystem": "Windows NT 10.0","TimeStampUTC": null,"AdditionalFootprintInfo": null}}
Concatenated string
string
Concating all values in payload and headers.
Calculation: `${Url}${Method}${UserId}${Payload}`
You should end up withhttps://acc-interconnect.icepay.com/api/contract/authorisationPOSTB4980F36-K45K-4DBF-BF6E-DG3941B2TG83{"Contract":{"ContractProfileId":"B4980F36-K45K-4DBF-BF6E-DG3941B2TG83","AmountInCents":100,"CurrencyCode":"EUR","Reference":"kx7ypcrygxe"},"Fulfillment":{"PaymentMethod":"AFTERPAY","IssuerCode":"AFTERPAY","AmountInCents":100,"CurrencyCode":"EUR","Reference":"kx7ypcrygxe","FreeFormatData":null,"Consumer":{"Reference":null,"Address":{"CountryCode":"NL","City":"Somecity","PostalCode":"1234AA","Street":"Street","HouseNumber":"40","HouseNumberExtension":null,"CareOf":null},"Category":"Person","IdentificationNumber":null,"Prefix":"Mr","FirstName":"John","LastName":"Doetwo","Initials":null,"Email":"test@test.com","Phone":null,"MobilePhone":"0612345678","BirthDate":"1980-10-10T00:00:00","Gender":"Unknown","LanguageCode":"nl","IPAddress":"192.168.0.1"},"DeliveryConsumer":null,"Order":{"OrderNumber":"kx7ypcrygxe","CurrencyCode":"EUR","TotalGrossAmountCents":100,"TotalNetAmountCents":100,"VatAmountCents":0,"DiscountAmountCents":0,"ShippingCostCents":0,"ShippingCostVatCents":0,"OrderItems":[{"LineNumber":null,"ProductId":"1","ProductName":"Book","GroupId":"25","UnitCode":null,"Quantity":1,"GrossUnitPriceCents":100,"NetUnitPriceCents":100,"VatCategory":null,"VatPercent":21,"VatAmountCents":0,"DiscountAmountCents":0}]},"Timestamp":"2018-11-21T13:27:36.2690603Z","LanguageCode":"nl","Description":null},"Postback":{"UrlCompleted":"https://acc-interconnect.icepay.com/demo/FinalizeSuccessful","UrlError":"https://acc-interconnect.icepay.com/demo/FinalizeWithError","UrlsNotify":["https://acc-interconnect.icepay.com/demo/api/Payment/NotifyAuthorisation"]},"IntegratorFootprint":null,"ConsumerFootprint":{"IPAddress":"10.244.1.217","Browser":"Chrome 70.0.3538.102","OperatingSystem":"Windows NT 10.0","TimeStampUTC":null,"AdditionalFootprintInfo":null}}
Base64 HMAC
string
Calculated HMAC value with below functions.
Value: PeGFvtsSsSPmG+1y55rtiD4+c2Txv30YdB2MzsOhUZ8=

Production environment Checksum example

POST https://interconnect.icepay.com/api/contract/authorisation

UserId
string
User identity value to specify in headers (also known as ContractProfileId)
Example value: 87407ae9-cbfa-4459-bb98-63860a090dad
Secret
string
Secret for the contract profile
Example value: Dk0d+pNVTgNtkuu9GSr6AbV8BIWJGaCgx0KEqfEN7ag=
Payload
object

Example value:?{"Contract": {"ContractProfileId": "87407ae9-cbfa-4459-bb98-63860a090dad","AmountInCents": 1000,"CurrencyCode": "EUR","Reference": "12345"},"Fulfilment": {"PaymentMethod": "AFTERPAY","IssuerCode": "AFTERPAY","AmountInCents": 1000,"CurrencyCode": "EUR","Reference": null,"Consumer": {"Reference": null,"Address": {"CountryCode": "NL","Street": "Dorpstraat","HouseNumber": "1","HouseNumberExtension": null,"PostalCode": "1111AA","City": "Amsterdam"},"Category": "Person","FirstName": "Luke","LastName": "Skywalker","Email": "luke@starwars.com","Phone": "+31620342122","BirthDate": "1996-04-23T00:00:00Z","Gender": "Male","LanguageCode": "NL","IPAddress": null},"Order": {"OrderNumber": "12345","CurrencyCode": "EUR","TotalGrossAmountCents": 1000,"TotalNetAmountCents": 1000,"DiscountAmountCents": 0,"OrderItems": [{"ProductId": "12345-0","ProductName": "Some product","Quantity": 1,"GrossUnitPriceCents": 1000,"NetUnitPriceCents": 1000,"VatCategory": null}]},"Timestamp": "2018-04-23T14:22:05.49949Z","LanguageCode": "NL"}
Concatenated string
string
Concating all values in payload and headers.
Calculation: `${Url}${Method}${UserId}${Payload}`
Base64 HMAC
string
Calculated HMAC value with below functions.
Possible Value: gizdzIhmrrB2Z+/kHtEonmqLp/Tdhz23c7Ldl6Qve54=

Sample Code – PHP


function generateHMAC($url, $method, $request, $userId, $secret) {
    $data = $url.$method.$userid.$request;
    $hash = hash_hmac("sha256", $data, base64_decode($secret), true);
    return base64_encode($hash)
}
     
//If using curl don't forget to set the headers
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json",
    "CHECKSUM: $hash",
    "USERID: $userid"
));

Sample Code – C#

private string CalculateChecksum(string url, string method, string rawRequest, string contractProfileId, string hmacKey)
{
    StringBuilder checksumSource = new StringBuilder();
    checksumSource.Append(url);
    checksumSource.Append(method);
    checksumSource.Append(userID);
    checksumSource.Append(rawRequest);
    using (var hmacsha256 = new HMACSHA256(Convert.FromBase64String(hmacKey)))
    {
        var encoding = new UTF8Encoding();
        byte[] hash = hmacsha256.ComputeHash(encoding.GetBytes(checksumSource.ToString()));
        var checksum = System.Convert.ToBase64String(hash);
        return checksum;
    }
}