# OpenCart callback not updating order status: diagnosis in 3.0 and 4.1

> Step-by-step fix when your OpenCart callback isn't updating order status. Check URL access, signature, amount, addOrderHistory and logs in 3.0 and 4.1.

Джерело: https://opencartcode.com/en/wiki/dev-flows/opencart-callback-not-updating-order-status
OpenCart: 3.0, 4.1
Оновлено: 2026-11-25

When the OpenCart payment callback doesn't change the [order status](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#order-status), the cause almost always lies in one of four places. Sometimes the payment request never reaches the [controller](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#controller). Sometimes it arrives, but the module rejects it during validation. Sometimes validation passes, but `addOrderHistory()` (3.0) or `addHistory()` (4.1) sets a different status than you expected. And sometimes the status does change, but you're looking in the wrong place. Below is a checking order that helps you find the problem in a few minutes instead of guessing.

Examples are for OpenCart 4.1; in 4.0.x, model triggers and event handling work differently.

## Where to start: where exactly is the callback getting lost?

The callback (also called a server-to-server notification or webhook) arrives at your server as a separate request from the [payment system](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#payment-system). There is no customer session in it, and no cart either. The module only sees the request parameters, must find the order itself, verify the signature, and trigger the status change. How such a module works overall is described in the article about [the form, callback and payment confirmation](https://opencartcode.com/en/wiki/dev-flows/opencart-payment-module). Here we only cover what to do when the chain breaks somewhere.

It helps to split the request path into stages and check them one by one, from the server to the database:

```mermaid
flowchart TD
  A["Payment system sends callback"] --> B{"Request in server logs?"}
  B -- "no" --> B1["URL, HTTPS, WAF, redirect"]
  B -- "yes" --> C{"Response 200?"}
  C -- "503 / 302" --> C1["Maintenance mode or PHP error"]
  C -- "200" --> D{"Signature and amount match?"}
  D -- "no" --> D1["Raw data, key, currency"]
  D -- "yes" --> E{"New row in order_history?"}
  E -- "no" --> E1["order_id, before event, exception"]
  E -- "yes" --> F["Check which status was recorded"]
```

The first question is always the same: did the request reach the server? Check the web server access log or the request log in the payment provider's dashboard. Most providers show which address they called, what HTTP code they received, and how many times they retried. If the dashboard shows 404, 403 or a timeout, you don't need to open the module code yet.

## Why doesn't the request reach the module controller?

### Wrong callback address

The module usually builds the address via `$this->url->link()`. There is a trap here that is easy to miss: the method HTML-encodes ampersands.

- **OpenCart 3.0:** `link($route, $args = '', $secure = false)` always replaces `&` with `&amp;` when arguments are passed.
- **OpenCart 4.1:** `link(string $route, $args = '', bool $js = false)` encodes ampersands unless the third parameter is `false`. For the address you give the payment provider in an API request, pass `true`.

If `&amp;order_id=15` ends up in the callback address, the payment system will send the request, but the parameter will arrive under the name `amp;order_id`, and the module won't find it. Without arguments the address looks like `index.php?route=...` and this problem doesn't occur.

A second common mistake concerns the method separator in the route. In 3.0 the method is separated by a slash (`extension/payment/mypay/callback`), in 4.1 by a dot (`extension/mypay/payment/mypay.callback`). A module moved from 3.0 without this fix returns a "not found" page in 4.1. Details are in the article about [route= routing in 3.0 and 4.1](https://opencartcode.com/en/wiki/dev-mvc/opencart-route).

### Maintenance mode

The versions behave differently here, and this is a frequent cause of "it broke after the upgrade."

- **OpenCart 3.0:** `startup/maintenance` skips routes that start with `extension/payment`, as well as `api`. The callback works even when the store is closed for maintenance.
- **OpenCart 4.1:** the exception only remains for `api`. Any payment module callback receives the maintenance page with code 503 if the administrator isn't logged in in the same browser (the payment provider, of course, isn't).

So if in 4.1 you closed the store overnight for work, and orders were paid from cached pages or links, those callbacks won't be processed. Most providers retry the request, but not all of them, and not indefinitely.

### Protection in front of OpenCart

Hosting WAFs, Cloudflare with a browser check, HTTP authentication on a test domain, or a redirect from http to https or from www to non-www can stop the request before it reaches PHP. Redirects are especially tricky: some payment system clients don't follow a 301 and don't resend the POST body. That's why the callback address must be final, meaning it already uses the correct protocol and domain.

## How do you see what the module received and what it responded?

Once the request reaches PHP, the next step is to write everything that arrived to your own log. Don't rely on the core error log: it only records PHP errors, not the module rejecting a wrong signature. Logging the raw request at the start of the `callback()` method immediately shows what actually arrives.

Example: diagnostic log in the callback (OpenCart 4.1)

```php
public function callback(): void {
    $log = new \Opencart\System\Library\Log('mypay_callback.log');

    $raw = file_get_contents('php://input');

    $log->write('METHOD: ' . ($this->request->server['REQUEST_METHOD'] ?? ''));
    $log->write('CONTENT_TYPE: ' . ($this->request->server['CONTENT_TYPE'] ?? ''));
    $log->write('RAW: ' . $raw);
    $log->write('POST: ' . json_encode($this->request->post));

    // далі звичайна перевірка підпису й зміна статусу
}
```

In 3.0 the class is global, so the line looks like `$log = new Log('mypay_callback.log');`. In both branches the file goes into the logs directory (`DIR_LOGS` with `config.php`); the location is described in the article about the [storage directory](https://opencartcode.com/en/wiki/dev-architecture/opencart-storage). After diagnostics, remove the raw body logging or mask personal data in it.

This log immediately answers two common questions:

- **POST is empty, but RAW is filled.** The payment system sends JSON (`application/json`). PHP fills `$_POST` only for forms, so `$this->request->post` will be empty in both versions. Read `php://input` and parse the JSON yourself.
- **Values in POST differ from RAW.** The Request class in both branches passes input through `htmlspecialchars`. Quotes and ampersands in POST are already converted, so a signature computed from them won't match. Why this happens is explained in the article about [Request and Response](https://opencartcode.com/en/wiki/dev-architecture/opencart-request-response).

Error log: look for entries with the callback arrival time · OpenCart 4.1.0.4

Also check the core error log in the admin: System → Maintenance → Error Logs. If Display Errors is enabled on the Server tab in the settings, the PHP warning text is output directly into the response body. A payment system expecting exactly `OK` or JSON treats such a response as an error and retries the request. In 4.1 there's one more variant: with error display turned off, an unhandled exception redirects the request to `error.html`, and the payment system sees a 302 instead of a 200.

## The module rejects the callback: signature, amount, order

If the log shows the data arrived but the status didn't change, add a log entry to every rejection branch: "signature mismatch," "order not found," "amount mismatch." Without this, the rejection is silent, and from the outside it looks as if the module "does nothing."

### Signature

Typical causes of a mismatch: the signature is computed from processed data instead of raw data (see above); the module settings contain the test key while the provider is in live mode (or vice versa); there's an extra space in the key after copying; or the field being signed is not the one the provider signs. Log both values, the computed one and the received one, and compare them manually.

### Order identifier

Often the module doesn't pass the payment system a bare `order_id` but a string with a prefix or timestamp, so the identifier stays unique on repeated payment. If in the callback you simply do `(int)`, a string like `shop-15-1732` becomes 0. `getOrder(0)` finds nothing, and `addOrderHistory()` (3.0) or `addHistory()` (4.1) silently does nothing: the whole method is wrapped in `if ($order_info)`.

### Amount and currency

In the `order` table, the `total` field is stored in the store's default currency. The customer, however, is billed in the order currency at the `currency_value` rate. If the module sent the amount via `$this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false)` but the callback compares it with a "raw" `total`, the check will never pass on a [multi-currency](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#multi-currency) store. Compare using the same expression that was used to calculate the amount when sending, and account for rounding to the cent. How these fields are filled is shown in the article about the [order table](https://opencartcode.com/en/wiki/dev-database/table-order-opencart).

> Don't "fix" the callback by disabling signature or amount checks. The callback address is public, and without verification anyone can mark their order as paid with a single POST request.

## addOrderHistory (3.0) or addHistory (4.1) was called, but the status is wrong: what to check?

Sometimes the log shows that validation passed and the call was made, yet the order in the admin still has the old status or isn't visible at all. First look in the database to see what was actually recorded:

Example: order status history

```sql
SELECT o.order_id, o.order_status_id, h.order_status_id AS history_status, h.comment, h.date_added
FROM oc_order o
LEFT JOIN oc_order_history h ON h.order_id = o.order_id
WHERE o.order_id = 15
ORDER BY h.date_added;
```

### Status 0 and "missing" orders

If no status is selected for successful payment in the module settings, the key such as `payment_mypay_order_status_id` is empty, and 0 is passed to the method. The order stays with status 0. By default, the order list in both admin versions shows only `order_status_id > 0`, so such an order isn't visible among regular ones. You can find it by selecting Missing Orders in the status filter (the name may differ in translated admin versions).

Order list: status filter with the option for orders with status 0 · OpenCart 4.1.0.4

### Fraud status instead of paid

When an order moves to the processing or complete status, `addOrderHistory()` in 3.0 and `addHistory()` in 4.1 runs two checks that can replace your status:

1. Anti-fraud modules (type `fraud`), if they are enabled and the customer isn't marked as "safe." The `check()` method of such a module can return a different status.
2. The `confirm()` method of total modules. A coupon or reward points (and in 3.0, also a gift voucher) that have already been used or are insufficient return `config_fraud_status_id`.

As a result, the status selected in the Fraud Order Status field appears in the history. Check what is selected on the Option tab under System → Settings, and whether the order has a coupon.

Option tab: processing, complete and fraud order statuses · OpenCart 4.1.0.4

### The status is not in the "processing statuses"

Stock deduction, coupon confirmation and emails only run when moving to statuses marked in the Processing Order Status or Complete Order Status fields on the same Option tab. If the module sets a status that isn't in these lists, the status changes but the rest of the logic won't run. This mechanism is covered in full in the article about [addOrderHistory and status changes](https://opencartcode.com/en/wiki/dev-flows/addorderhistory-opencart).

### A before event intercepts the call

In 3.0, a handler for the `catalog/model/checkout/order/addOrderHistory/before` event that returns anything other than null cancels the method call. The status doesn't change and there's no error. In 4.1, the value returned by a handler is ignored, but the handler can modify arguments by reference (for example, the status). Review the list under [Extensions](https://opencartcode.com/en/wiki/glossary/e-commerce-glossary#extensions) → Events and temporarily disable third-party events on the order model. How triggers work is described in the article about the [event system](https://opencartcode.com/en/wiki/dev-events-ocmod/events-opencart).

## How do you test the callback without a real payment?

The fastest way is to repeat the request yourself. Copy the raw body and headers sent by the payment system from your own log, and send them with curl to the same address:

Example: replaying the callback from the log (4.1)

```bash
curl -i -X POST \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-raw "data=...&signature=..." \
  "https://example.com/index.php?route=extension/mypay/payment/mypay.callback"
```

The `-i` flag shows the response code and headers, so you can immediately see a 503, a 302, or extra warning text in the body. Re-running the same request is safe for the status: `addOrderHistory()` (3.0) or `addHistory()` (4.1) will add one more row to the history, but stock and coupons are processed only on the first transition to the processing status. Remember that the customer email may be sent a second time if the module passes `$notify = true`, so on a live store it's better to test on your own order.

If the provider has a test mode, verify that it uses separate keys and that the module is actually switched to it. Many "mysterious" failures happen because a test payment is signed with the test key while the module checks against the live one.

A special case: the payment succeeded, but the customer didn't return to the site. In 3.0, the order already exists at that point with status 0 (created by the confirmation step), so the callback has something to update. How and when it appears in 3.0 and 4.1 is covered in the article about [checkout in code](https://opencartcode.com/en/wiki/dev-flows/checkout-opencart-kod). A version of this same problem for the store owner, without code, is described in the article on what to do if [the payment went through but the status didn't change](https://opencartcode.com/en/wiki/payments/order-status-not-updating-after-payment).

## Summary

- First establish whether the request reached the server: the payment provider's dashboard and the access log show the address, response code and retries.
- Check the address: `&amp;` with `url->link()`, the method separator (slash in 3.0, dot in 4.1), the final protocol, and a domain without redirects.
- In 4.1, maintenance mode blocks payment module callbacks; in 3.0 it does not.
- Log the raw request and every rejection branch. JSON doesn't go into `$this->request->post`, and compute the signature from raw data.
- Verify the amount in the same currency and with the same rate as when it was sent, and extract `order_id` from the string carefully.
- If the call was made but the status is wrong, check status 0, the Fraud status, the processing status lists, and events on the order model.

Other articles on how the core calculates the cart, creates orders and changes statuses are collected in the section ["Cart, checkout and orders in code"](https://opencartcode.com/en/wiki/dev-flows).

## FAQ

**How many times does a payment system retry a callback if the server did not respond?**

It depends on the provider: some retry the request several times with increasing delays, others send it only once. Check the exact policy in the payment system's documentation, and make your handling of retries safe on your side.

**Can I change the status of a paid order manually while the callback is not working?**

Yes, add a history entry in the order card in the admin with a status that is part of the processing statuses. Then the core will deduct stock and confirm coupons the same way as with a callback.

**Why does the callback work on the test domain but not on the live one?**

Most often the differences are the address in the payment provider's dashboard, the keys for test and live mode, or protection in front of the site (WAF, Cloudflare, redirect to another domain). Compare the response codes in the provider's log for both domains.

**Is a customer session required to process the callback?**

No. The callback arrives without the customer's cookie, so the module takes everything from the request parameters and the order table, not from the session or cart.
