Nordea banklink(pangalink) specifics

Recently I wrote about Banklink(Pangalink) payment configuration with php.

Here in Estonia, most of banks use iPizza mechanism (such as SwedBank, Sampo and SEB).
Nordea uses SOLOPMT (thanks Kurapov for a clue)

So, here is the code and explanations for generating form to post payment to Nordea bank:

 $VK_a_nordea['SOLOPMT_VERSION'] = '0003'; // ID of security type. Use either 0002 or 0003.
   $VK_a_nordea['SOLOPMT_STAMP'] = date('U',mktime()); // Session ID. It is mandatory and its value can be random - more useful for the Seller to track payments. I used Unix epoch time.
   $VK_a_nordea['SOLOPMT_RCV_ID'] = 12345678; // ID of the Seller. Is obtained in bank while signing the agreement.
   $VK_a_nordea['SOLOPMT_AMOUNT'] = 10; // Payment sum.
   $VK_a_nordea['SOLOPMT_REF'] = '1234561'; // reference link. Some companies use it for dividing payments on one bank account. It is mandatory and didn't get the idea, how it is generated. I used the example, provided by Nordea in it's document
   $VK_a_nordea['SOLOPMT_DATE'] = 'EXPRESS'; //Can be either 'Express' or follow up date.
   $VK_a_nordea['SOLOPMT_CUR'] = 'EUR'; // Payment currency.

// this is the function for generation of mac key.
function genMac($arrFields, $strMacKey){
       $strMac='';
       foreach ((array)$arrFields as $key=>$item){
           $strMac.=str_replace('&','&',$item).'&';
       }
       $strMac.=$strMacKey.'&';
       $strMac=strtoupper(md5($strMac));
       return $strMac;
   }


$VK_a_nordea['SOLOPMT_MAC'] = genMac($VK_a_nordea,"sadglgu4365456qsfdsQEWQ"); //key is sent by bank
$VK_a_nordea['SOLOPMT_MSG'] = 'Client'; // Payment message.
   $VK_a_nordea['SOLOPMT_KEYVERS'] = '0001'; // Digital signature. See further how to generate it.
       $url='http://www.yoursite.ee'; //the domain should be the same as specified while signing the agreement
   $VK_a_nordea['SOLOPMT_RETURN'] = $url. '/pangalink/vk_return_nordea.php'; // page, there bank will return in case of successful payment.
   $VK_a_nordea['SOLOPMT_REJECT'] = $url. '/pangalink/vk_return_nordea.php'; // page, there bank will return in case of successful payment.
   $VK_a_nordea['SOLOPMT_CANCEL'] = $url. '/pangalink/vk_return_nordea.php'; // page, there bank will return in case of payment cancellation. If it is the same page as  VK_RETURN, you can leave it blank.
   $VK_a_nordea['SOLOPMT_LANGUAGE'] = 4; // Preferred Invoice language 3 = English, 4 = Estonian, 6 = Latvian, 7 = Lithuanian

print '
'; foreach ($VK_a_nordea as $VK_name => $VK_value) { print ''; } print ''; print '
';

To create a return file, use the following code:

$MAC_KEY="sadglgu4365456qsfdsQEWQ"; //provided by Nordea
$hash=$_REQUEST['SOLOPMT_RETURN_VERSION'].'&'.
$_REQUEST['SOLOPMT_RETURN_STAMP'].'&'.
$_REQUEST['SOLOPMT_RETURN_REF'].'&'.
$_REQUEST['SOLOPMT_RETURN_PAID'].'&'.
$MAC_KEY.'&';
        $hash=strtoupper(md5(($hash)));
if($hash==$_REQUEST['SOLOPMT_RETURN_MAC']){ //success verification
if (isset($_REQUEST['SOLOPMT_RETURN_PAID'])) {
        echo( 'Payment was successful!' );
}else{ //failure
            echo( 'Payment was aborted!' );
}
}else {
        echo('Incorrect signature');
}

Nordea document E-Payment_v1_1

Leave a Reply

%d bloggers like this: