How do I send a unique order ID for each request to the payment gateway?

I have a shopping basket. I want to integrate with CCAvenue payment gateway. I always send the order id from the database. After checking, suddenly my system shuts down. Then again I have to check that it is being sent again. The order ID from my database is duplicated for the payment gateway. That's my problem.

My question is, how do I send a unique order ID every time? My site is in PHP.

+1


a source to share


3 answers


With most payment gateways, you can send a single "sell" transaction to an "auth + capture" transaction, or you can send an authorization and capture transaction as two separate requests.

If you are concerned about the transaction consistency issue with sending a single sale transaction, my recommendation is to send authorization to reserve funds first and then send a capture when the order process is complete.



If the system fails at the time of initial authorization in the worst case, funds are released within three days when your authorization contract expires. You have to take care that there is no worst case authorization as it blocks the use of authorized funds until it is cleared, which can sometimes lead to frustrating clients.

If the system is down during the final capture and you are unable to record the status, you can simply restart the capture later, in which case the result will either be successful or a message from the gateway indicating that the capture has already occurred, which can then be used to update the payment status of your system.

+2


a source


I think there should be a separate function for this - all the time, checking if the previous version of the order is in the cart or not. In addition, a copy of the process must always be kept in the db. This way, if for some reason the server restarts, the order can still be executed from the same position (thus there will be no problem with duplicate orders).



0


a source


Perhaps you want a unique identifier http://us3.php.net/uniqid , although your question is a bit vague.

0


a source







All Articles