Integrating a CMI payment gateway with WooCommerce in Morocco
Step-by-step engineering guide to connect the Centre Monétique Interbancaire (CMI) to WooCommerce: Moroccan merchant contracts, SHA-512 hashing, IPN webhooks, and sandbox testing.
1. How the CMI payment architecture operates on WooCommerce
2. Technical prerequisites and hosting requirements
- ✓ Valid TLS 1.3 SSL certificate across canonical www domain.
- ✓ WooCommerce store default currency set to Moroccan Dirham (MAD).
- ✓ Full legal pages (Terms, Return policy, Privacy, Legal notice with company ICE).
- ✓ Firewall rules allowing incoming POST webhooks from CMI IP blocks.
3. Configuring merchant keys and SHA-512 hash calculation
| CMI parameter | Expected format | Example | Technical function |
|---|---|---|---|
| clientid | 10-digit integer | 6000012345 | Unique CMI merchant account ID |
| amount | 2-decimal float with dot | 450.00 | Total transactional order value |
| currency | CMI ISO numerical code | 504 (MAD) | Interbank Moroccan Dirham code |
| storeKey | Alphanumeric secret string | AbC123XyZ!987... | Private salting key for SHA-512 hash |
| callbackUrl | Direct HTTPS URL | https://www.site.com/?wc-api=cmi_ipn | Direct server webhook validation |
4. Banking certification protocol and production launch
Conclusion & Action Plan
Integrating the Moroccan CMI gateway elevates your WooCommerce store into a modern, trusted e-commerce platform. Eliminating delivery return risks and streamlining order flows makes it a high-return investment for any Moroccan merchant.
Frequently Asked Questions
What are the typical transaction fees with Moroccan CMI ?
Commissions are negotiated with your acquiring Moroccan bank under the VAD contract. Typically, rates range from 1.5% to 2.5% ex. VAT for Moroccan domestic cards, and up to 3.0% to 3.5% for international Visa and Mastercard cards.
Can a store combine CMI online payment with Cash on Delivery ?
Yes, this is the benchmark hybrid setup in Morocco. Shoppers can choose between secure upfront card payment (often incentivized with free shipping) or traditional cash upon delivery.
Why do CMI payment notifications occasionally fail ?
The most frequent cause is a security plugin or WAF (Wordfence, Cloudflare) blocking the incoming server-to-server POST webhook from CMI. Whitelisting CMI IP blocks resolves this immediately.
E-commerce engineer and WordPress specialist based in Marrakech, focused on Moroccan CMI gateways, Stripe setups, and conversion-first checkout flows.
Services & technical solutions related to this guide
Discover tailored engineering services by Ali Ouarzazi to implement these strategies:
Certified integration of CMI, PayZone, Stripe, and optimized COD checkout funnels.
Custom WordPress online stores tailored for Moroccan domestic and global sales.
Turnkey e-commerce architectures, inventory sync, and frictionless checkout flows.
Ready to discuss your web project?
Direct exchange with Ali Ouarzazi. Fast quote under 24 hours.