Praxis Wiki logo

Overview How to build a signature


Step-by-Step

Request signature is built as follows:

  1. Merchant ID is added to request parameters as "merchant_id":"..."
  2. API version is added to request parameters as "version":"1.1"
  3. all parameter keys are taken in alphabetical order
  4. corresponding parameter values are concatenated into a string
  5. Merchant Secret is appended in the end of the string
  6. resulting string is hashed with sha384 - signature
  7. signature parameter is added to the request JSON

Please check out the online generator and validator to test your code.

{danger.fa-exclamation} IMPORTANT: Current encryption algorithm applies to API version 1.1 (document version 3.3). Please pay attention at the request version that you are using.

PHP Example

Generate signature (PHP example)

// Signature builds for all request according to single criteria

// Your request data
$data = ['your_variable_key_1' => 'your_variable_value_1', 'your_variable_key_2' => 'your_variable_value_2', 'your_variable_key_3' => 'your_variable_value_3'];

$merchant_id = "Test-Integration-Merchant"; // Your Merchant Account ID 
$merchant_secret = "MerchantSecretKey"; // Your Merchant Secret
$request = [
    "your_variable_key_1" => "your_variable_value_1", 
    "your_variable_key_2" => "your_variable_value_2",
    "your_variable_key_3" => "your_variable_value_3",
    "merchant_id" => $merchant_id,
    "timestamp" => 1559825373,
    "version" => "1.1"
];

ksort($request); // Sort request array by keys ASC

$concatenated_string = implode('', $request) . $merchant_secret; // Concatenate Merchant Secret Key with request params
// Integration TEST USDTest-Integration-Merchant15688553921.1ABCDEFMerchantSecretKey

$signature = hash('sha384', $concatenated_string); // Generate HASH of concatenated string
// c8d9b1824601bb6e11342afc36cb7281892daead2fbae257ea2d2ff8aa4908d66d5863a429e247d47155c01a0592e482

You are currently viewing version 3.3 Latest version here