ovac/laravel-hubtel-payment

一个用于消费 Hubtel Payment Api 的 Laravel 扩展包

v1.0.2 2018-12-05 17:51 UTC

README


Laravel Hubtel Payment

Laravel 5.5 对 OVAC Hubtel Payment 包的集成。

Build Status Scrutinizer Code Quality Coverage Status Latest Stable Version Packagist Packagist Dependency Status

SensioLabsInsight

 Follow me anywhere @ovac4u                         | GitHub
 _________                          _________       | Twitter
|   ___   |.-----.--.--.---.-.----.|  |  |.--.--.   | Facboook
|  |  _   ||  _  |  |  |  _  |  __||__    |  |  |   | Instagram
|  |______||_____|\___/|___._|____|   |__||_____|   | Github + @ovac
|_________|                        www.ovac4u.com   | Facebook + @ovacposts

简介。

Laravel Hubtel Payment 是 Laravel 5.5 对 OVAC Hubtel Payment php 客户端的无缝集成,用于消费 Hubtel Payment API 并在 Laravel 应用中处理移动货币交易。

使用此包,可以轻松处理移动货币交易并自动处理来自和前往加纳任何移动货币订阅者的移动货币支付。

安装

此包使用 Composer,有关如何安装 Composer 的更多信息,请阅读Composer 文档

通过 composer 安装

composer require ovac/laravel-hubtel-payment

注册服务提供者

注意!如果您使用 laravel>=5.5 并具有包自动发现功能,则此步骤和下一步是可选的。

将服务提供者添加到 config/app.php 文件中的 providers 部分

OVAC\LaravelHubtelPayment\ServiceProvider::class,

注册外观

config/app.php 文件中的 aliases 部分注册包外观

'HubtelPayment' => OVAC\LaravelHubtelPayment\Facades\LaravelHubtelPayment::class,

发布配置文件

php artisan vendor:publish --provider="OVAC\LaravelHubtelPayment\ServiceProvider" --tag="config"

编辑 .env

在应用程序 .env 文件中添加以下行,并使用以下示例中的 Hubtel 商户账户号码、ClientID、ClientSecret 和回调。

不知道这是什么?请查看此文档

HUBTEL_ACCOUNT_NUMBER=HM00000 #Your Hubtel Merchant Account Number
HUBTEL_CLIENT_ID=XXXXXXXX     #Your Hubtel Merchant Client ID
HUBTEL_CLIENT_SECRET=XXXXXXXX #Your Hubtel Merchant Client Secret.
HUBTEL_CALLBACK_URL=https://example.com/payment_success #Default Callback URL
HUBTEL_SECONDARY_CALLBACK_URL=https://example.com/error

基本用法

此库公开了一组外观,可以无缝与 hubtel-payment php 客户端的主要类进行接口,以便在基本用法中可选地进行本地配置。

注意:有关高级用法,请参阅位于此处的 OVAC Hubtel Payment 文档。

只需使用 Laravel 外观别名 HubtelPayment:: 代替原生调用即可。

享受 :)

可以使用 ReceiveMoney 外观将提示发送到客户的手机,就像移动货币代理一样:

<?php

use OVAC\LaravelHubtelPayment\Facades\HubtelPayment;

// NOTE: The phone number must be of type string as Laravel considers all numbers with a leading 0 to be a hex number.
$payment = HubtelPayment::ReceiveMoney()
                ->from('0553577261')                //- The phone number to send the prompt to. 
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->description('Online Purchase')    //- Description of the transaction.
                ->customerName('Ariama Victor')     //- Name of the person making the payment.callback after payment. 
                ->channel('mtn-gh')                 //- The mobile network Channel.configuration
                ->run();                            //- Run the transaction after required data.

可以使用 SendMoney 外观将资金发送到任何移动货币客户:

<?php

use OVAC\LaravelHubtelPayment\Facades\HubtelPayment;

// NOTE: The phone number must be of type string as Laravel considers all numbers with a leading 0 to be a hex number.
$payment = HubtelPayment::SendMoney()
                ->to('0553577261')                  //- The phone number to send the prompt to.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->description('Online Purchase')    //- Description of the transaction.
                ->customerEmail('admin@ovac4u.com') //- Name of the person making the payment.
                ->channel('mtn-gh')                 //- The mobile network Channel.
                ->run();                            //- Run the transaction after required data.

可以使用 Refund 外观对客户先前交易中支付的款项进行退款:

<?php

use OVAC\LaravelHubtelPayment\Facades\HubtelPayment;

$payment = HubtelPayment::Refund()
                ->transactionId(1234)               //- The ID of the transaction to refund.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->clientReference('#11212')         //- A refeerence on your end.
                ->description('Useless Purchase')   //- Description of the transaction.
                ->reason('No longer needs a pen')   //- Name of the person making the payment.
                ->full()                            //- Full or partial refund.
                ->run();                            //- Run the transaction after required data.

贡献

感谢您考虑为 Laravel Hackathon Starter 贡献。贡献指南可在 贡献文件 中找到。

安全

如果您发现任何与安全相关的问题,请通过电子邮件联系,而不是使用问题跟踪器。

致谢

参考

如何感谢您?

为什么不在 github 仓库上 star?我很乐意得到关注!为什么不在 Twitter 或 HackerNews 上分享此仓库的链接?传播消息!

别忘了在 instagramtwitter 上关注我

谢谢!Ariama Victor (ovac4u)。