Integrating CMI Payment Gateway in WooCommerce: Step-by-Step Guide Morocco 2026

Complete technical guide to integrating the CMI payment gateway in WooCommerce for Moroccan e-commerce. Setup, testing, SSL requirements and troubleshooting.

Integrating CMI Payment Gateway in WooCommerce: Step-by-Step Guide Morocco 2026

Integrating CMI Payment Gateway in WooCommerce: Step-by-Step Guide Morocco 2026

CMI (Centre Monetique Interbancaire) is Morocco's official interbank payment gateway — mandatory for accepting card payments from Moroccan bank accounts (CIH, Attijariwafa, Banque Populaire, BMCE) in WooCommerce.

Understanding CMI

CMI acts as intermediary between your WooCommerce store and Morocco's banking network. The customer is redirected to CMI's secure 3D-Secure page, then back to your store. Settlement occurs within 2-3 business days.

Prerequisites

  • CMI merchant contract: Apply through your bank — processing time 2-4 weeks
  • SSL certificate: HTTPS is mandatory for CMI approval
  • WooCommerce 7.0+: Ensure your install is current
  • PHP 8.1+: Required by CMI PHP library

Step-by-Step Integration

Step 1: Install the CMI WooCommerce Plugin

Use the official plugin from GitHub (cmi-payment/woocommerce-cmi-gateway). Avoid unofficial versions — payment plugin vulnerabilities are critical security risks.

Step 2: Configure Merchant Credentials

In WooCommerce Settings — Payments — CMI, enter: ClientID, Store Key, OK URL, Fail URL and CallBack URL provided by your bank.

Step 3: Configure Callback URL (Critical)

The CallBack URL (IPN) is where CMI sends transaction results server-to-server. It must be publicly accessible over HTTPS and must validate the CMI signature before updating order status.

Step 4: Test with CMI Test Cards

  • Approved: 4355084355084358 (Expiry: 12/26, CVV: 000)
  • Declined: 4111111111111111

Step 5: Go Live Checklist

  • Switch from test to production mode in plugin settings
  • Replace test credentials with production credentials from your bank
  • Verify SSL certificate validity (minimum 6 months remaining)
  • Place a real test order to confirm the full flow

Common Issues and Solutions

  • Order stuck in \"Pending\": Callback URL blocked by server firewall
  • Signature mismatch error: Store key contains special characters needing encoding
  • Callback URL returns 404: Check WooCommerce permalink settings

Need help integrating CMI with your WooCommerce store? See my e-commerce development services or request a free quote.

🔗 Related service: → E-commerce Morocco & France
Share: LinkedIn Twitter WhatsApp