Order Guard module - prevents duplicate orders and duplicate payment or invoice statements
Prevent duplicate orders, resulting in two invoices or two payments when the payment gateway or status change occurs twice simultaneously. And fix existing duplicates in your store by returning trapped stock.
Compatible with PrestaShop 1.7.6 to 9.x. No overrides.
Orders
The customer paid once. Your store has two orders.
Two payment gateway notifications arrive simultaneously, both asking if the order exists before either has created it, and two are generated: each with its invoice, payment, and deducted stock. No standard check detects them because both appear to be working correctly internally. RKR Order Guard causes the second notification to wait.
/ It prevents it before it happens
And fix the ones you already have
In Orders → Duplicate Orders, you can review the entire history, not just orders placed after installation. Each duplicate cart is categorized according to the recorded payments:
The screen tells you which order will be kept and why, and lets you change it. The surplus is marked as Cancelled—it's never deleted—and stock is measured before and after, so you only replenish what hasn't been returned. You can simulate first: the trial counts exactly the same as the actual execution.
What it never does : issue a return or call the payment gateway; modify an order for which a package has already been shipped; remove an already numbered invoice that requires a correction; or execute anything in batches without you selecting the groups and confirming. And if the blocking process runs out, the sale continues anyway: the module never cancels an order.
It alerts you to what it finds
It detects four problems —duplicate order, duplicate invoice, overcharge, and unbalanced order— and records them in an incident log that is retained even if you uninstall the module.
Compatible with PrestaShop 1.7.6 to 9.x
Developed and maintained by REKIRE
v1.2.0
The flaw has a variant that version 1.1.0 didn't detect: when the payment module creates the order AFTER payment, what gets duplicated isn't the invoice, but the order itself . Each remains internally consistent—the invoice with its line items and its payment reconciled—so none of the three previous criteria flagged it. On a real store with 143,649 orders: 29 carts with two orders, and of the 54 most recent, version 1.1.0 would have flagged zero .
- New criterion
duplicate_order: There is another LIVE order in the same cart with a different reference. The reference is what distinguishes it from a split by package, which PrestaShop does intentionally and in which all orders share the same reference—therefore, a unique index onorders.id_cartis not the correct array. This is checked inactionValidateOrder, which is when a new order is detected, and in each subsequent check. - New screen: Orders → Duplicate Orders. Review and fix those already in the store, which until now had to be done manually one by one. It doesn't look at
RKROG_SINCE: that date is for live monitoring, and this is precisely the place to see the previous one. - The classification is the important part of that screen , and it comes from
order_payment.transaction_id, which is core and doesn't depend on the payment gateway: A is one payment and two orders—the excess is canceled, there's no extra money—, B is two separate payments—money needs to be refunded, and that's decided by a person—, and C is undetermined, which is only listed. Only case A is modified. - And what it doesn't do, which is equally important : if the surplus has a numbered invoice, the invoice is not touched (that requires a correction), if a package has been sent out, nothing is touched, the gateway is never called nor is a return issued, and nothing is executed in batches without marking and confirming it.
- Simulating counts exactly the same as executing. The entire decision resides in
analizar()`, which doesn't write anything;aplicar()only executes what has already been decided. The report balances by construction (grupos = reparados + saltados + sin nada) and the screen warns if it ever doesn't balance. - Stock is measured, not assumed. The core system returns stock upon cancellation, but only if the previous state was relevant and the product isn't handled through advanced management. Stock is measured before and after, and only what hasn't been returned is replenished: adding stock just in case would result in a double return, which is worse than not returning it at all.
- The gateway reference becomes the FIRST lock key. On a server that only allows one
GET_LOCKper session, only the first key is used, and with the shopping cart in front, the two gateway calls were locking different names: zero mutual exclusion, and the module was installed, active, and doing nothing. The gateway reference is the only one that arrives via both paths—the server-to-server notification usually comes without any of our parameters. - Optional logging of taken locks (
RKROG_TRACE, factory disabled). Without it, discovering the above takes an afternoon: there was no way to see which key had blocked a request.
4 other products in the same category
Viewed products
También podría interesarte
Questions and answers
Nobody has asked anything about this product yet.