"1002",
"VK_VERSION" => "008",
"VK_SND_ID" => "uid100010",
"VK_STAMP" => "3606",
"VK_AMOUNT" => "0.01",
"VK_CURR" => "EUR",
"VK_ACC" => "LT657300010135270430",
"VK_NAME" => "BIGBANK AS FILIALAS",
"VK_REF" => "36061",
"VK_MSG" => "9e42d160fab2f7c996a99b3a77678b54",
"VK_RETURN" => "https://dsm-banklink-frontend-lt-dev.dca.origin.big.local/r",
"VK_CANCEL" => "https://dsm-banklink-frontend-lt-dev.dca.origin.big.local/r",
"VK_LANG" => "LIT",
"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! Swedbank Lithuania 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"] . /* 1002 */
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"] . /* uid100010 */
str_pad (mb_strlen($fields["VK_STAMP"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_STAMP"] . /* 3606 */
str_pad (mb_strlen($fields["VK_AMOUNT"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_AMOUNT"] . /* 0.01 */
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"] . /* 36061 */
str_pad (mb_strlen($fields["VK_MSG"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_MSG"]; /* 9e42d160fab2f7c996a99b3a77678b54 */
/* $data = "0041002003008009uid10001000436060040.01003EUR005360610329e42d160fab2f7c996a99b3a77678b54"; */
// STEP 4. Sign the data with RSA-SHA1 to generate MAC code
// ========================================================
openssl_sign ($data, $signature, $private_key, OPENSSL_ALGO_SHA1);
/* NLN9hc+Auy4v0cyNE+ckQV1+5GAszYo/9GeznAGR4KeHT0wLE8OaGDr4aiuLxMbqSfvGzBhevWNIqR2T69swjUtTlbPBX3o94tS4StpsmVWzGnmTY7ms2m/BJ6pds4DBgqPf8zK3VKxMMXILEhD+13ZFs5aq2Bcb5kMt1nzWHv2P3Pj0zOAh2vHIOBnF4TIcNsy5G89iNHgvpax2zL/f0X2brzrF0iQwZq2LShJkXvfvf9zYhv6CQKo431AgqV7oXLCN1ej3jCATgCWJ8VqqW7Z+CFD+4+YQWhxPB72bkZMLtzsmWr20GMzmF2yghiXOh5l4qq9yJWMIX3GDiQEU7w== */
$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 "Swedbank Lithuania"