php - How to generate a unique transaction id in a shopping cart -
i working on shopping cart , local payment gateway requires each transaction have unique order id. id supposed saved in database against order details , sent variable payment gateway. dilemma on how generate unique id , how save before sending variables gateway can check matches when response received gateway's ipn. variable in question show below:
$reference = $_post['reference'];//unique order id of transaction, generated merchant
do not use md5() on uniqueid() loose on security. append or prepend md5 value ok.
that said stick http://www.php.net/manual/en/pdo.lastinsertid.php newly inserted id, generate uniqueid() prefix parameter set lets 'username_' way should pretty unique.
Comments
Post a Comment