"1012", "VK_VERSION" => "008", "VK_SND_ID" => "uid100049", "VK_STAMP" => "72750", "VK_AMOUNT" => "65.40", "VK_CURR" => "EUR", "VK_REF" => "727503", "VK_MSG" => "Tellimuse 72750 makse", "VK_RETURN" => "https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/", "VK_CANCEL" => "https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/", "VK_DATETIME" => "2020-11-16T14:15:20+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! Swedbank 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"] . /* uid100049 */ str_pad (mb_strlen($fields["VK_STAMP"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_STAMP"] . /* 72750 */ str_pad (mb_strlen($fields["VK_AMOUNT"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_AMOUNT"] . /* 65.40 */ 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"] . /* 727503 */ str_pad (mb_strlen($fields["VK_MSG"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_MSG"] . /* Tellimuse 72750 makse */ str_pad (mb_strlen($fields["VK_RETURN"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_RETURN"] . /* https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/ */ str_pad (mb_strlen($fields["VK_CANCEL"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_CANCEL"] . /* https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/ */ str_pad (mb_strlen($fields["VK_DATETIME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_DATETIME"]; /* 2020-11-16T14:15:20+0000 */ /* $data = "0041012003008009uid1000490057275000565.40003EUR006727503021Tellimuse 72750 makse055https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/055https://geenius.ee/wc-api/WC_Banklink_Swedbank_Gateway/0242020-11-16T14:15:20+0000"; */ // STEP 4. Sign the data with RSA-SHA1 to generate MAC code // ======================================================== openssl_sign ($data, $signature, $private_key, OPENSSL_ALGO_SHA1); /* C8pCIgqMvL5F3BLe0MDVU/pc7q58MuDKpsZUOWxJxrBGp42QM1OU26YnNVvUucr4x/3gHz+4c8AvbPu2Vh50xqnrCMaFBA/EWTDbRSAA7dVQqYv56QiT5DRcd2NVwOTkVoO0HXlvRCsZgvDLMJCNeV45mLbS+ifshQJWKaj/MZYlZ0tDjyeP2KbGTukDMgKqVtZEJY0YBzoipO4grEHkykfzMxw/MwAVap2RqgeqqkKysNoTgISS0O5LQgGJ3Wy/AiFxws5yXo1GBk6raREjJJoU+il2UrpazmDxnSXpLYxOOjRdVZ9053U0EU3sOrdn+iRE6wUBYqxmWx2C2Ghogw== */ $fields["VK_MAC"] = base64_encode($signature); // STEP 5. Generate POST form with payment data that will be sent to the bank // ========================================================================== ?>

Pangalink-net

Makse teostamise näidisrakendus "Swedbank"

$val):?> $val):?>