Skip to content
OpenCart · User manual

CMI ECOM Payment gateway

Version 1.0.1
Chapter 5

Payments and orders

This chapter follows a payment from the checkout to the CMI page and back, explains how each order status is set, and lists the scenarios to test before going live.

At checkout

  1. The customer chooses the CMI payment method. The payment step shows Secure Payment Gateway with the logos of CMI, MarocPay, Verified by Visa, MasterCard SecureCode, American Express and UnionPay, and the Pay with CMI button. If you set up the terms checkbox, it appears above the button.
  2. The customer presses Pay with CMI. The order is saved with the Pending Order Status.
  3. A short page appears while the browser is sent to the CMI payment page. Its text is in Spanish for Spanish customers and in English for everyone else.
  4. On the CMI page the customer enters the card details and, if required, completes 3D Secure with the bank.

The CMI page opens in French for French customers, in Spanish for Spanish customers and in English for everyone else. The store sends CMI the order number, the amount in dirham, and the customer's billing name, company, address, e-mail and telephone. Accents and special characters are removed from these texts, because CMI accepts only plain letters and numbers.

How the order status is set

CMI sends the result of every payment directly to your store, server to server. The extension accepts the message only if:

  • its hash matches the one calculated with your Store Key;
  • the order exists;
  • the amount matches the order total in dirham, to the cent.

Then it saves the transaction details (CMI transaction ID, authorisation code, masked card number, card brand and the full answer) and updates the order:

Result from CMIOrder statusOrder history comment
Approved (return code 00)Paid Order StatusCMI Success, with the CMI response and transaction ID
Any other resultFailed Order StatusCMI Rejected, with the CMI response and code

The status is changed only once: an order already in the paid status is never moved again, and a failed notice never overwrites a paid order. On OpenCart 3.x the customer is notified by e-mail of the new status.

When the customer returns

What happens on CMIWhat the customer sees
The payment is approvedThe order success page. The cart is emptied.
The payment is declinedThe checkout, with Payment declined by the bank. followed by the CMI response.
The payment failsThe checkout, with Payment process failed. followed by the CMI response.
The customer cancels on the CMI pageThe checkout, with Payment process failed. The order receives the Failed Order Status.

On OpenCart 1.5, the extension also checks the signed result that comes back with the customer and updates the order status from it, in case the server-to-server message has not arrived yet.

On OpenCart 3.x, if the answer that comes back with the customer has a wrong hash, the customer sees Security validation failed (Hash Mismatch). Please contact the administrator.

Testing before going live

CMI usually asks merchants to show the main scenarios before activating production. With Gateway Mode on Test and the test credentials from CMI, check each case and the order status it produces:

  1. An approved payment: the order reaches the Paid Order Status and the customer sees the success page.
  2. A declined payment: the order reaches the Failed Order Status and the customer sees the declined message.
  3. A cancelled payment: the customer leaves the CMI page with the cancel button, returns to the checkout with the failed message and the order reaches the Failed Order Status.
  4. A 3D Secure payment, if 3D Secure is enabled on your merchant account.

Use the test cards that CMI provides for each case. After each test, open the order in Sales > Orders and read its history: the CMI comment shows the response and transaction ID.

Captures and other operations

The extension does not capture, cancel or return payments from OpenCart. Depending on the Capture Mode, CMI captures approved payments automatically or leaves them authorised. Use the merchant tools of CMI for any later operation, then update the order status in OpenCart.

Still need help?

Open a support ticket from your account and our team will look at your store with you.