“Order amount has changed” message on payment gateway callbacks handling

For orders paid online a payment gateway may send special callback requests to update order status in the online store. Such callback requests usually contain the order amount, which must be compared to the current order amount to ensure that the order contents have not changed.

If the order amount has changed, the order status will not be changed. Apparently, some additional actions are performed on an order in the store and a payment gateway should not interfere with that process. In such cases you will see the following message in the order processing history:

Order amount has changed: ... expected, ... received. Currency: ...

How order amount verification works

The amount in a payment gateway’s callback request may slightly differ from a current order amount. For example, by 1.1 cents or less. It might be caused by a rounding error or be a result of order amount conversion from another currency. Such minor amount discrepancies are ignored by Shop-Script.

Sometimes this difference might be greater than 1.1 cents but still insignificant; e.g., 2 cents. In such cases, the order status will not be updated and the message shown above will be added to the order history.

How to change the order amount verification logic

If you are sure that the difference of up to 2 cents is not too high for automatic order status updates, then you can increase the order amount verification threshold value. To do so, save a desired value, greater than the default 0.011, to configuration file wa-config/apps/shop/config.php:

'order_amount_tolerance' => 0.02,

If there is no such parameter in that file, add it in next to existing records as shown below:

'products_per_page' => 50,
'...' => ...,
'order_amount_tolerance' => 0.02,

If you have no such file at all, create it with the following contents:

<?php

return array(
    'order_amount_tolerance' => 0.02,
);

Upon saving the file, clear Webasyst cache in Settings app.

0 comments

    Add comment

    To add a comment please sign up or login