PHP package to communicate with the CMI payment plateform in Morocco

Overview

CMI PHP Payment bindings

CMI PHP PAYMENT is an open source PHP payment handling library. it provides an easier way to communicate with CMI PAYMENT PLATEFORM cmi.co.ma in morocco.

The class is written OOP to make easier to communicate and understand how CMI work.

NB: The small library follows the FIG standard PSR-4 .

System Requirements

cmi-php requires the following components to work correctly

Composer Installation

You can install the bindings via composer. Run the following command:

composer require mehdirochdi/cmi-payment-php

To use the bindings, use Composer's autoload

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer for some reason, you can usethe bindings, include the init.php file.

require_once('/path/to/cmi-php/init.php');

Getting Started

Example amount text fields example/formRequest.php:

...
    <h1>Payment form CMI</h1>
    <form method="post" action="/example/process.php">
    <label for="amount">Amount</label>
        <input type="text" name="amount" class="input-control" placeholder="put amount here 10.65" value="10.60"> DHS<br/>
        <button type="submit">Buy</button>
    </form>
...

Keeping mind that storekey and clientid are given by CMI, you should contact them cmi.co.ma

<?php
// REQUIRED PARAMS
$client = new CMI\CmiClient([
    'storekey' => '', // STOREKEY
    'clientid' => '', // CLIENTID
    'oid' => '135ABC', // COMMAND ID IT MUST BE UNIQUE
    'shopurl' => 'YOUR_DOMAIN_HERE', // SHOP URL FOR REDIRECTION
    'okUrl' => 'YOUR_DOMAIN_HERE/okFail.php', // REDIRECTION AFTER SUCCEFFUL PAYMENT
    'failUrl' => 'YOUR_DOMAIN_HERE/okFail.php', // REDIRECTION AFTER FAILED PAYMENT
    'email' => '[email protected]', // YOUR EMAIL APPEAR IN CMI PLATEFORM
    'BillToName' => 'mehdi rochdi', // YOUR NAME APPEAR IN CMI PLATEFORM
    'BillToCompany' => 'company name', // YOUR COMPANY NAME APPEAR IN CMI PLATEFORM
    'amount' => $_POST['amount'], // RETRIEVE AMOUNT WITH METHOD POST
    'CallbackURL' => 'YOUR_DOMAIN_HERE/callback.php', // CALLBACK
]);

$client->redirect_post(); // CREATE INPUTS HIDDEN, GENERATE A VALID HASH AND MAKE REDIRECT POST TO CMI
?>

Payment page

Basic test card numbers

Credit Card information cannot be used in test mode. instead, use any of the following test card numbers, a valid expiration date in the future, and any random CVC number, to create a successful payment.

Branch : visa, PAN: 4000000000000010, Expired date: make any date CVC: 000

Branch : MasterCard, PAN: 5453010000066100, Expired date: make any date CVC: 000

3D Secure test card numbers

The following card information try to tests local payments such as Strong Customer Authentication SCA

Branch : MasterCard, PAN: 5191630100004896, Authentication code: 123 Expired date: make any date CVC: 000

Payment page

Optional Params Example

<?php
// REQUIRED PARAMS
$client = new CMI\CmiClient([
    ...
]);

$client->AutoRedirect = 'true'; // REDIRECT THE CUSTOMER AUTOMATICALY BACK TO THE MERCHANT's WEB SITE WHEN TRANSACION IS ACCEPTED
$client->redirect_post(); // CREATE INPUTS HIDDEN, GENERATE A VALID HASH AND MAKE REDIRECT POST TO CMI
You might also like...
Alipay driver for the Omnipay PHP payment processing library

Omnipay: Alipay Alipay driver for the Omnipay PHP payment processing library Omnipay is a framework agnostic, multi-gateway payment processing library

UnionPay driver for the Omnipay PHP payment processing library

Omnipay: UnionPay UnionPay driver for the Omnipay PHP payment processing library Omnipay is a framework agnostic, multi-gateway payment processing lib

Integrate Paytm Payment gateway to php website.

paytm-integration-kit-project-for-PHP Integrate Paytm Payment gateway to php website. Copy PaytmKit folder in document root of your server (like /var/

ShurjoPay payment gateway integration for PHP applications.

ShurjoPay PHP Library Using this library you can integrate ShurjoPay payment gateway into your PHP applications. If you face any problem then create i

First Data driver for the Omnipay PHP payment processing library

Omnipay: First Data First Data driver for the Omnipay PHP payment processing library Omnipay is a framework agnostic, multi-gateway payment processing

A PHP library to integrate with eWAY's Rapid Payment API.

A PHP library to integrate with eWAY's Rapid Payment API.

WHMCS Payment Gateway Module for Coinify

vrcoinify WHMCS Payment Gateway Module for Coinify Installing guide You should copy all contents from module folder to your WHMCS application folder u

Lightweight abstraction layer for payment gateways
Lightweight abstraction layer for payment gateways

Slickpay is lightweight abstraction layer for payment gateways. Documentation Documentation for Slickpay can be found on official website. Licence The

A site to sell an E-book with paystack payment gateway integrated

YoungAndGetRich This is a platform to sell the named book using paystack payment gateway. Technology used are: MySql database PHP HTML5 CSS3 Bootstrap

Comments
  • CallbackURL

    CallbackURL

    Hello, I'm working with cmi api in a react and node js project. My problem is with callback URL, in the Integration kit they mentioned that it should be accessible through internet with specific port 80 443 but I didn't deploy my website yet. And when I redirect the callback request to my local file it doesn't work.

    Below the screen of the error page capt

    opened by nissrinel 3
  • Optional Params Example Error

    Optional Params Example Error

    hello How are you ? i use you package is very usefull ,but you have problem with "Optional Params Example" $client = new Mehdirochdi\CMI\CmiClient([ ... ]); $client->AutoRedirect = 'true';

    you should put : $client = new Mehdirochdi\CMI\CmiClient([ 'AutoRedirect' => 'true', ]); to work if you you put with your way it alwayse give this error :

    3D-1004 - Code de sécurité eronné

    and thank you

    opened by adilelkhalloufi 1
  • Direction vers la page de paiement CMI

    Direction vers la page de paiement CMI

    Bonjour Mehdi

    J'espère que vous allez bien, j'ai vu le tuto de l'intégration CMI paiement et je trouve un problème au niveau de direction vers la page de paiement CMI. Rien n'apparaît dans la page, seulement une page blanche, quoique tous les paramètres sont envoyés. Merci Capture

    opened by MRSIMOHAMED 2
  • Payment Page Image URL Not Working

    Payment Page Image URL Not Working

    Hello brother,

    I am a new PHP learner. I wanted to look at the "Payment Page" image but the URL is giving "Cannot proxy the given URL" error.

    Can you please tell me how can i access it?

    Thank you so much

    opened by hellforhord 1
Owner
medhi rochdi
PHP, Laravel Vue.js Developer, creator of : PHP Maroc: https://bit.ly/37JcrdY ACDM: https://bit.ly/35JTPrY
medhi rochdi
Set of classes and tools to communicate with a Noso wallet using NosoP

NosoPHP Set of classes and tools to communicate with a Noso wallet using NosoP(Noso Protocol) Examples Node Info include __DIR__ . '/vendor/autoload.p

Noso Project 1 Jan 10, 2022
The whmcs payment module for TigoPesa Payment Gateway.

whmcs-tigopesa INSTALLATION INSTRUCTIONS TIGOPESA WHMCS Please follow the instructions below to setup the whmcs-tigopesa gateway module. Download zipp

Medson Naftali 3 Dec 11, 2021
The Laravel eCommerce Accept Payment Gateway allows the customer to make use of Accept payment gateway in the Bagisto eCommerce website.

Introduction Bagisto WeAccept add-on allow customers to pay for others using WeAccept payment gateway. Requirements: Bagisto: 1.3.2 Installation with

Bagisto 2 May 31, 2022
The Laravel eCommerce ABA Payment Gateway module allows the admin to integrate the ABA payment gateway to the online store.

Introduction Bagisto ABA Payment Gateway. Requirements: Bagisto: v1.3.2. Installation with composer: Run the following command composer require bagist

Bagisto 3 May 31, 2022
With the help of the Laravel eCommerce CashU Payment Gateway, the admin can integrate the CashU payment method in the Bagisto store.

Introduction Bagisto CashU Payment add-on allow customers to pay for others using CashU payment gateway. Requirements: Bagisto: v1.3.2 Installation wi

Bagisto 2 Aug 22, 2022
Simple laravel package for 2C2P Payment Gateway.

Laravel 2C2P Payment Gateway Simple laravel package for 2C2P Payment Gateway. Installation You can install the package via composer: composer require

null 3 Dec 7, 2021
uPay(bangladesh) payment gateway integration package for laravel

uPay BD Payment Gateway Requirements PHP >=7.2 Laravel >= 6 Installation composer require codeboxr/upay vendor publish (config) php artisan vendor:pub

Codeboxr CodeHub 6 Sep 24, 2022
A framework agnostic, multi-gateway payment processing library for PHP 5.6+

Omnipay An easy to use, consistent payment processing library for PHP Omnipay is a payment processing library for PHP. It has been designed based on i

The League of Extraordinary Packages 5.7k Dec 30, 2022
CPAY is a sdk that encapsulates the Orange Money api with an intuitive syntax allowing you to integrate the Orange Money payment into your PHP project.

CPAY CHOCO PAY is a sdk that encapsulates the Orange Money api with an intuitive syntax allowing you to integrate the Orange Money payment into your P

faso-dev 1 Oct 26, 2022
PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Payum 1.7k Dec 27, 2022