fm-labs/cakephp-mpay24
最新稳定版本:1.0.2
Composer 安装命令:
composer require fm-labs/cakephp-mpay24
包简介
Mpay24 plugin for CakePHP
README 文档
README
CakePHP wrapper for Mpay24's official PHP SDK Client MPAY24's official PHP SDK
- Mpay24 GitHub: https://github.com/mpay24/mpay24-php
- Mpay24 Docs: https://docs.mpay24.com/docs
- Mpay24 Demo: https://docs.mpay24.com/docs/get-started
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require fm-labs/cakephp-mpay24
// src/Application.php class Application extends \Cake\Application { public bootstrap($configDir) { // ... your bootstrap code ... $this->addPlugin('FmLabs/Mpay24') } }
Configuration
// config/mpay24.php <?php return [ 'Mpay24' => [ 'production' => [ 'merchantId' => '', 'merchantPassword' => '', 'useTestSystem' => false, 'debug' => true, ], 'testing' => [ 'merchantId' => '', 'merchantPassword' => '', 'useTestSystem' => true, 'debug' => true, ] ] ];
Usage
Api Client
try { $mpay24 = new \FmLabs\Mpay24\Lib\Mpay24Client('testing'); $mdxi = new \FmLabs\Mpay24\Lib\Mpay24Order() // ... setup mdxi order ... if (!$mdxi->validate()) { throw new \RuntimeException('Failed to validate MDXI.'); } $mpay24Response = $mpay24->paymentPage($mdxi); $paymentPageURL = $mpay24Response->getLocation(); // get redirect location to the payment page if ($paymentPageURL) { // ... redirect user to payment page ... } } catch (\Exception $ex) { debug("Something went wrong: " . $ex->getMessage()); }
Testdata
All testdata in the official docs: https://docs.mpay24.com/docs/test-data
Credit cards
Test data:
Mastercard card number: 5555444433331111
Visa card number: 4444333322221111
Expiry date: arbitrary, see Test scenarios below
Test scenarios: Various scenarios results can be created by providing different expiry dates of the credit card for brand VISA and MASTERCARD:
| Expiry | date month | status | returnCode | errNo | errText |
|---|---|---|---|---|---|
| 01 | ERROR | DECLINED | 1 | ||
| 02 | ERROR | EXTERNAL_ERROR | 100 | Karte abgelaufen (card expired). | |
| 03 | ERROR | EXTERNAL_ERROR | 100 | ||
| 04 | ERROR | EXTERNAL_ERROR | 100 | ||
| 05 | OK | OK | |||
| >= 06 | OK | REDIRECT |
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-24