"1012",
"VK_VERSION" => "008",
"VK_SND_ID" => "uid100036",
"VK_STAMP" => "19",
"VK_AMOUNT" => "3.53",
"VK_CURR" => "EUR",
"VK_REF" => "194",
"VK_MSG" => "Plastok tellimus 08.03.2021 11:02 Ref.:19",
"VK_RETURN" => "https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/",
"VK_CANCEL" => "https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/",
"VK_DATETIME" => "2021-03-08T11:02:46+0000",
"VK_LANG" => "EST",
"VK_ENCODING" => "UTF-8"
);
// STEP 3. Generate data to be signed
// ==================================
// Data to be signed is in the form of XXXYYYYY where XXX is 3 char
// zero padded length of the value and YYY the value itself
// NB! SEB expects symbol count, not byte count with UTF-8,
// so use `mb_strlen` instead of `strlen` to detect the length of a string
$data = str_pad (mb_strlen($fields["VK_SERVICE"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SERVICE"] . /* 1012 */
str_pad (mb_strlen($fields["VK_VERSION"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_VERSION"] . /* 008 */
str_pad (mb_strlen($fields["VK_SND_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SND_ID"] . /* uid100036 */
str_pad (mb_strlen($fields["VK_STAMP"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_STAMP"] . /* 19 */
str_pad (mb_strlen($fields["VK_AMOUNT"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_AMOUNT"] . /* 3.53 */
str_pad (mb_strlen($fields["VK_CURR"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_CURR"] . /* EUR */
str_pad (mb_strlen($fields["VK_REF"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_REF"] . /* 194 */
str_pad (mb_strlen($fields["VK_MSG"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_MSG"] . /* Plastok tellimus 08.03.2021 11:02 Ref.:19 */
str_pad (mb_strlen($fields["VK_RETURN"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_RETURN"] . /* https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/ */
str_pad (mb_strlen($fields["VK_CANCEL"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_CANCEL"] . /* https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/ */
str_pad (mb_strlen($fields["VK_DATETIME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_DATETIME"]; /* 2021-03-08T11:02:46+0000 */
/* $data = "0041012003008009uid100036002190043.53003EUR003194041Plastok tellimus 08.03.2021 11:02 Ref.:19066https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/066https://api.plastok.pastel.thorgate.eu/d/banks/thorbanks_response/0242021-03-08T11:02:46+0000"; */
// STEP 4. Sign the data with RSA-SHA1 to generate MAC code
// ========================================================
openssl_sign ($data, $signature, $private_key, OPENSSL_ALGO_SHA1);
/* m7oCKJXPmrpdgF03kwnV2oPahJFqhH45yLb8F1MN4qDjuRrm9KqHoA7Lp73Qpyv4hl54xblnwcbjtJV9L5EWlbbHwXau4E0uA4iupOdd6tWuslx/q66C3ouY8HHY9D/o8wKm1XEBwuEaNjCBwKqn9S3fXGsAs+v+Q0SatPZCmSaWzC65Nl1OTrOCx1Xui2fnr3ZUub4jN+/srC9YwcJeWEOBsHvZXg28eYumcYa1oUB4m8SzL2Lh/hegO3plKyGgwlnN1z08WOGBGSAcTLhkQJ7rAhszeWA6vEMF7XLeuPrscb1/+i4sFDFyRUQQ5ldCmDPgDdi94wjXdqn64XCxQA== */
$fields["VK_MAC"] = base64_encode($signature);
// STEP 5. Generate POST form with payment data that will be sent to the bank
// ==========================================================================
?>
Makse teostamise näidisrakendus "SEB"