I am implementing my own payment module for Magento, where I implemented getCheckoutRedirectUrl() method in my payment model.
class My_Module_Model_Payment extends Mage_Payment_Model_Method_Abstract {}
This method is supposed to just return URL of payment gateway where user is redirected to, but I should also append current orderId to this URL.
The problem is am not able to get orderId. I tried solution as already accepted here
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
but I get empty $orderId. So this doesn't seem to work in my method. The call doesn't produce error, so I get an object (for example Mage::getSingleton('checkout/session')->getQuote()->getSubtotal() returns order amount), but orderId is empty.
I also tried:
$order = Mage::getModel('sales/order');
$order->load(Mage::getSingleton('sales/order')->getLastOrderId());
$orderId = $order->getIncrementId();
which again returns empty $orderId.
Any Ideas?