diff --git a/index.php b/index.php
index <HASH>..<HASH> 100644
--- a/index.php
+++ b/index.php
@@ -8,9 +8,6 @@ use Payment\Saferpay\Saferpay;
 
 session_start();
 
-// get session data if exists
-$saferpayData = isset($_SESSION) && is_array($_SESSION) && array_key_exists('saferpay.data', $_SESSION) ? $_SESSION['saferpay.data'] : null;
-
 // create a new saferpay instance (implement as service)
 $saferpay = new Saferpay();
 
@@ -32,6 +29,9 @@ $saferpay->getConfig()->setInitDefaultConfig(new SaferpayKeyValue($arrConfig['de
 $saferpay->getConfig()->setConfirmDefaultConfig(new SaferpayKeyValue($arrConfig['defaults']['confirm']));
 $saferpay->getConfig()->setCompleteDefaultConfig(new SaferpayKeyValue($arrConfig['defaults']['complete']));
 
+// get session data if exists
+$saferpayData = isset($_SESSION) && is_array($_SESSION) && array_key_exists('saferpay.data', $_SESSION) ? $_SESSION['saferpay.data'] : null;
+
 $saferpay->setData($saferpayData);
 
 if(getParam('status') == 'success')
get session data at the moment it's needed