tchdev/monetbil
Composer 安装命令:
composer require tchdev/monetbil
包简介
This will display the payment interface of monetbil (MTN/ORANGE/EU MONEY)
README 文档
README
This repository contains the open source PHP SDK that allows you to access the Monetbil Platform from your laravel app.
Requirements
PHP 5.2 and later.
Download the SDK
https://github.com/Monetbil/monetbil-php/archive/master.zip
Installation
Composer Installation
The best way to install monetbil is quickly and easily with composer.
To install the most recent version, run the following command.
composer require tchdev/monetbil
Laravel
If you don't use auto-discovery, open up your app config and add the Service Provider to the $providers array:
'providers' => [ ... Propaganistas\LaravelPhone\PhoneServiceProvider::class, ],
and aliases to the $aliases array:
'aliases' => [ ... 'Monetbil' => Tchdev\Monetbil\Facades\Monetbil::class, ],
Publish file with the command :
php artisan vendor:publish Which provider or tag's files would you like to publish?: [0 ] Publish files from all providers and tags listed below [1 ] Provider: Facade\Ignition\IgnitionServiceProvider [2 ] Provider: Fideloper\Proxy\TrustedProxyServiceProvider [3 ] Provider: Illuminate\Foundation\Providers\FoundationServiceProvider [4 ] Provider: Illuminate\Mail\MailServiceProvider [5 ] Provider: Illuminate\Notifications\NotificationServiceProvider [6 ] Provider: Illuminate\Pagination\PaginationServiceProvider [7 ] Provider: Laravel\Tinker\TinkerServiceProvider [8 ] Provider: Tchdev\Monetbil\MonetbilServiceProvider [9 ] Tag: flare-config [10] Tag: ignition-config [11] Tag: laravel-errors [12] Tag: laravel-mail [13] Tag: laravel-notifications [14] Tag: laravel-pagination [15] Tag: public > Enter the number of the package (Tchdev\Monetbil\MonetbilServiceProvider) and press "enter"
Now go to your .env file and add this :
MONETBIL_KEY=YOUR_MONETBIL_KEY MONETBIL_SECRET=YOUR_MONEBIL_SECRET_KEY MONETBIL_VERSION=YOUR_MONETBIL_VERSION
Payment Widget Usage
Example 1
<?php use Tchdev\Monetbil\Facades\Monetbil; // Setup Monetbil arguments Monetbil::setAmount(500); Monetbil::setCurrency('XAF'); Monetbil::setLocale('en'); // Display language fr or en Monetbil::setPhone(''); Monetbil::setCountry(''); Monetbil::setItem_ref('2536'); Monetbil::setPayment_ref(md5(uniqid())); Monetbil::setUser(12); Monetbil::setFirst_name('KAMDEM'); Monetbil::setLast_name('Jean'); Monetbil::setEmail('jean.kamdem@email.com'); Monetbil::setReturn_url('your_redirect_url_after_payment'); Monetbil::setNotify_url('your_notification_url_to_receive_payment_data'); Monetbil::setLogo('https://storage.googleapis.com/cdn.ucraft.me/userFiles/ukuthulamovies/images/937-your-logo.png'); // Start a payment // You will be redirected to the payment page Monetbil::startPayment();
Or example 2
<?php use Tchdev\Monetbil\Facades\Monetbil; // Setup Monetbil arguments $monetbil_args = array( 'amount' => 500, 'phone' => '', 'locale' => 'en', // Display language fr or en 'country' => '', 'currency' => 'XAF', 'item_ref' => '2536', 'payment_ref' => md5(uniqid()), 'user' => 12, 'first_name' => 'KAMDEM', 'last_name' => 'Jean', 'email' => 'jean.kamdem@email.com', 'return_url' => 'your_redirect_url_after_payment', 'notify_url' => 'your_notification_url_to_receive_payment_data', 'logo' => 'https://storage.googleapis.com/cdn.ucraft.me/userFiles/ukuthulamovies/images/937-your-logo.png' ); // Start a payment // You will be redirected to the payment page Monetbil::startPayment($monetbil_args);
You can get the payment url.
Example 3:
<?php use Tchdev\Monetbil\Facades\Monetbil; // Setup Monetbil arguments Monetbil::setAmount(500); Monetbil::setCurrency('XAF'); Monetbil::setLocale('en'); // Display language fr or en Monetbil::setPhone(''); Monetbil::setCountry(''); Monetbil::setItem_ref('2536'); Monetbil::setPayment_ref(md5(uniqid())); Monetbil::setUser(12); Monetbil::setFirst_name('KAMDEM'); Monetbil::setLast_name('Jean'); Monetbil::setEmail('jean.kamdem@email.com'); Monetbil::setReturn_url('your_redirect_url_after_payment'); Monetbil::setNotify_url('your_notification_url_to_receive_payment_data'); Monetbil::setLogo('https://storage.googleapis.com/cdn.ucraft.me/userFiles/ukuthulamovies/images/937-your-logo.png'); // This example show payment url echo Monetbil::url();
Or example 4:
<?php use Tchdev\Monetbil\Facades\Monetbil; // Setup Monetbil arguments $monetbil_args = array( 'amount' => 500, 'phone' => '', 'locale' => 'en', // Display language fr or en 'country' => '', 'currency' => 'XAF', 'item_ref' => '2536', 'payment_ref' => md5(uniqid()), 'user' => 12, 'first_name' => 'KAMDEM', 'last_name' => 'Jean', 'email' => 'jean.kamdem@email.com', 'return_url' => 'your_redirect_url_after_payment', 'notify_url' => 'your_notification_url_to_receive_payment_data', 'logo' => 'https://storage.googleapis.com/cdn.ucraft.me/userFiles/ukuthulamovies/images/937-your-logo.png' ); ); // This example show payment url echo Monetbil::url($monetbil_args);
Example 3 and 4 response::
https://www.monetbil.com/pay/v2.1/UXaJoEvDiVBrQX9p9FGoFanlmp6t3H
You can integrate the payment widget on your own page.
Example 5:
<?php use Tchdev\Monetbil\Facades\Monetbil; // Setup Monetbil arguments Monetbil::setAmount(500); Monetbil::setCurrency('XAF'); Monetbil::setLocale('en'); // Display language fr or en Monetbil::setPhone(''); Monetbil::setCountry(''); Monetbil::setItem_ref('2536'); Monetbil::setPayment_ref(md5(uniqid())); Monetbil::setUser(12); Monetbil::setFirst_name('KAMDEM'); Monetbil::setLast_name('Jean'); Monetbil::setEmail('jean.kamdem@email.com'); Monetbil::setReturn_url('your_redirect_url_after_payment'); Monetbil::setNotify_url('your_notification_url_to_receive_payment_data'); Monetbil::setLogo('https://storage.googleapis.com/cdn.ucraft.me/userFiles/ukuthulamovies/images/937-your-logo.png'); // This example show payment button $payment_url = Monetbil::url(); ?> <style type="text/css"> .btnmnb { background: #3498db; background-image: -webkit-linear-gradient(top, #3498db, #2980b9); background-image: -moz-linear-gradient(top, #3498db, #2980b9); background-image: -ms-linear-gradient(top, #3498db, #2980b9); background-image: -o-linear-gradient(top, #3498db, #2980b9); background-image: linear-gradient(to bottom, #3498db, #2980b9); font-family: Arial; color: #ffffff; font-size: 20px; padding: 10px 20px 10px 20px; text-decoration: none; cursor: pointer; } .btnmnb:hover { background: #3cb0fd; background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); background-image: -o-linear-gradient(top, #3cb0fd, #3498db); background-image: linear-gradient(to bottom, #3cb0fd, #3498db); text-decoration: none; } </style> <?php if (Monetbil::MONETBIL_WIDGET_VERSION_V2 == Monetbil::getWidgetVersion()): ?> <form action="<?php echo $payment_url; ?>" method="post" data-monetbil="form"> <button type="submit" class="btnmnb" id="monetbil-payment-widget">Pay By Mobile Money</button> </form> <?php else : ?> <a class="btnmnb" href="<?php echo $payment_url; ?>" id="monetbil-payment-widget">Pay By Mobile Money</a> <?php endif; ?> <!-- To open widget, add JS files --> <?php echo Monetbil::js(); ?> <!-- To auto open widget, add JS files --> <?php echo Monetbil::js(true); ?>
If you have any questions or need help, do not hesitate to contact us at ramostchambia@gmail.com
tchdev/monetbil 适用场景与选型建议
tchdev/monetbil 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 324 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tchdev/monetbil 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tchdev/monetbil 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 324
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-06