I'm trying to add online payment in my magento store and the bank that I work with suggest for making tests that I send to them some variables for testing the security (between them the SID).

So my question is how to get SID in magento.

1 Answer 1


You can get the session ID with the below code:

$session = Mage::getSingleton('core/session');
$SID = $session->getEncryptedSessionId(); //current session id

You can easily get session-id from the core/session model.

  • Thank you for your answer, just I need to know where exactly to put code to make it work and display $SID May 8, 2015 at 9:43
  • you can see this code anywhere at frontend.As for payment gateway,you need to send data to it redirect url.
    – Amit Bera
    May 8, 2015 at 9:45
  • I create a file in www folder and place this code but it didn't show nothing after the line Mage::getSingleton('core/session') May 8, 2015 at 10:07
  • have you knowledge about magento basic structure ?
    – Amit Bera
    May 8, 2015 at 10:09
  • No Not too much May 8, 2015 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.