Hello,
My current payment module sends a time-stamp in UTC + 3 random numbers as a transaction ID to the payment processor as the order number is not set until payment has been completed successfully..
The accountant is complaining it's hard the match the Trans-ID to order numbers.
I was thinking to send the next available order number + 3 random numbers as the Trans-ID.
This will be wrong (one or two out on the order number) if several people are completing at once but not far out.
Any ideas how can I extract the next available order number from inside a payment module?
Extracting next available order number from a payment module.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Extracting next available order number from a payment module.
The way that PayPal does it: insert the order before redirecting off-site. Anything else is going to not match at least some of the time. Because if two people try to pay at the same time, both would get the same "next available order ID" unless you reserve it by inserting the order.
But if you reject that solution,Reference: https://stackoverflow.com/q/2251463
But if you reject that solution,
Code: Select all
$query = tep_db_query("SHOW TABLE STATUS LIKE 'orders'");
$data = $query->fetch_assoc();
echo $data['auto_increment'];