You could store the session id and use it as the orderID.... the only other solution would be to move the store order in database server behavior above the payment code. But then the order would be in the database before the payment is actually processed, so if the payment fails you would still have the order in the database... so you would have to hand edit the code to delete the order in the database when the payment failed.