Order electronic signature
Order electronic signature
An electronic signature is generated to prevent modifications to the payment form and must be included in every order form. The WEBPAY system will not process any orders without a valid digital signature.
To generate the signature, you must first set the Secret Key value in your billing account settings (Setting the Secret Key).
Please Note
If the fractional part of the order amount is zero, the format of the value used to calculate the wsb_signature depends on the format of the wsb_total field:
- if the field includes the fractional part (e.g.,
1.00), use the value with zeros. - if the field does not include the fractional part (e.g.,
1), use the value without zeros.
Every order form must include the following fields:
wsb_seed— a random sequence of characters (you can use the current timestamp, e.g.,Unix Timestamp).wsb_signature— the electronic signature itself. It must be generated according to the following rule from the values of these fields, concatenated in this exact order:wsb_seedwsb_storeidwsb_order_numwsb_testwsb_currency_idwsb_totalSecretKey
The fields must be concatenated into a single string without altering the specified order.
Depending on the specified protocol version (wsb_version), the MD5 hash (if the version is not specified) or the SHA1 hash (for version 2) of the concatenated string is calculated.
$wsb_seed = 1242649174;
$wsb_storeid = 11111111;
$wsb_order_num = "ORDER-12345678";
$wsb_test = 1;
$wsb_currency_id = "BYN";
$wsb_total = 21.90;
$SecretKey = "12345678901234567890";
// Concatenated string value:
// 124264917411111111ORDER-123456781BYN21.9012345678901234567890
// For protocol version 2 (wsb_version = 2)
$wsb_signature = sha1($wsb_seed.$wsb_storeid.$wsb_order_num.$wsb_test.$wsb_currency_id.$wsb_total.$SecretKey);
// Result: 338d1647833079f9353907ad266ec0bb5264c0d9
// If the version is not specified
$wsb_signature = md5($wsb_seed.$wsb_storeid.$wsb_order_num.$wsb_test.$wsb_currency_id.$wsb_total.$SecretKey);
// Result: 5b712daa1743d1a62dfdb7054b3978a1