定制 mehdirochdi/cmi-payment-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mehdirochdi/cmi-payment-php

Composer 安装命令:

composer require mehdirochdi/cmi-payment-php

包简介

PHP package to communicate with the CMI payment plateform in Morocco

README 文档

README

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 Mehdirochdi\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' => 'mehdi.rochdi@gmail.com', // 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 Mehdirochdi\CMI\CmiClient([
    ...
    'AutoRedirect' => 'true',
]);
OR
$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

统计信息

  • 总下载量: 3.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 85
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 85
  • Watchers: 6
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固