Playbook · E-commerce
How to integrate CMI with WooCommerce in Morocco in 7 days
TL;DR — Wiring the CMI gateway into WooCommerce in Morocco takes 7 days: 2 days opening the merchant contract (acquiring bank + CMI file), 1 day plugin install, 2 days 3DS + return URLs setup, 1 day CMI sandbox testing, 1 day production cutover. Typical merchant fees: 1.5–2.2% per transaction depending on volume.
CMI, the gateway to accept MAD payments
In Morocco, accepting card payments in dirhams on an e-commerce site almost always goes through CMI (Centre Monétique Interbancaire) — the national operator that routes payments to acquiring banks (Attijariwafa Bank, BMCE/Bank of Africa, BP, CIH, Société Générale Maroc, Crédit du Maroc).
Alternatives (Stripe, PayPal, Adyen) don't process MAD natively and charge in foreign currency with unfavorable FX. For an e-commerce targeting the local market, CMI is not optional: it's the default payment rail.
Pre-requisites before you start
A registered Moroccan company (RC, ICE, IF, business license), a corporate bank account with an acquiring bank, a WooCommerce site over HTTPS with a valid SSL certificate, and published terms and refund policy. CMI verifies these before activating the gateway in production.
Technical: WordPress 6+ and WooCommerce 8+, SFTP/SSH access to the server, and a staging environment for sandbox testing.
The 6 integration steps
Pre-requisites
- Registered Moroccan company (RC, ICE, IF)
- Corporate bank account with a Moroccan acquiring bank
- WooCommerce 8+ site over HTTPS with valid SSL
- Published terms and refund policy
- SFTP/SSH access to the production server
Step 1
Days 1–2 — Opening the merchant contract
File submitted to the acquiring bank: RC extract, articles, director KYC, RIB, site URL, business description. The bank forwards to CMI which returns a Store ID, Store Key and sandbox access within 48–72 business hours.
Step 2
Day 3 — Install CMI plugin for WooCommerce
Install an official or actively maintained plugin (several open-source options exist). Configure sandbox credentials first. Enable debug mode to trace requests during testing.
Step 3
Day 4 — 3D Secure and return URLs setup
Enable mandatory 3DS (otherwise issuer banks decline). Configure three URLs: OkUrl (success), FailUrl (failure), CallbackUrl (server-to-server notification). CallbackUrl must return HTTP 200 with no redirect.
Step 4
Day 5 — CMI sandbox testing
Test bench with CMI-provided test cards: success, 3DS failure, timeout, bank decline, double submission. Verify each case creates the correct WooCommerce order with the correct status (processing, failed, on-hold).
Step 5
Day 6 — CMI validation and production cutover
Submit test screenshots to CMI for validation. Once approved, CMI switches credentials to production. Update the plugin with prod credentials, disable sandbox mode.
Step 6
Day 7 — Monitoring and first real payment
First real payment by a team member (minimum amount). Verify the CMI → acquiring bank transfer (D+1 to D+3 depending on bank). Set up alerts on payment failures (Slack, WhatsApp, email).
Questions fréquentes
How much does CMI integration cost?+
How long does merchant account opening take?+
Does CMI accept Visa, Mastercard and Amex?+
Can we run recurring payments (subscriptions) via CMI?+
What if the CallbackUrl receives nothing?+
/ À lire ensuite
Un brief technique sur ce sujet ?
Atelier de cadrage gratuit. Un fondateur, pas un commercial.