kanazaca/easypay
Composer 安装命令:
composer require kanazaca/easypay
包简介
Laravel package for easypay.pt
README 文档
README
Laravel Package to work with easypay API
Feature Overview
- Support MB and credit-card (VISA, MASTERCARD, AMERICAN-EXPRESS)
- Create reference
- Get payment notification in real time
- Get all payments
- and will be more ...
Installation
Add this to your composer.json file, in the require object:
"kanazaca/easypay": "1.0.*"
After that, run composer install to install the package.
Add the service provider to config/app.php, within the providers array.
'providers' => array( // ... kanazaca\easypay\EasypayServiceProvider::class, )
Publish the config file.
php artisan vendor:publish
After this you might want change config file located at config/easypay.php with your credentials, etc
Lastly, run migrate to create easypay_notifications table
php artisan migrate
Usage
Create a reference
This code will ask easypay for a new reference which can be payed using MB or credit-card
$payment_info = [ 'o_name' => "Your name", 'o_email' => 'Your email', 't_value' => '29.00', 'o_description' => 'Here is your description', 'o_obs' => 'Here is your observations', 'o_mobile' => 'Here is your mobile', 't_key' => 'Here is the ID of your order' ]; $easypay = new EasyPay($payment_info); $reference = $easypay->createReference();
This will return an array with the following :
Array
(
[ep_status] => ok0
[ep_message] => ep_country and ep_entity and ep_user and ep_cin ok and validation by code;code ok - new reference generated - NEW REFERENCE -
[ep_cin] => your CIN
[ep_user] => your USER
[ep_entity] => your ENTITY
[ep_reference] => generated REFERENCE
[ep_value] => Asked value
[t_key] => Order ID sent
[ep_link] => Link to pay using credit-card
)
Now you can do what you want with this information, maybe you might want save to database to build user history payments.
Method to receive notifications in real time
When easypay get his payment they will call the URL that you provided to them which will execute a similiar method like below, for more details see (https://docs.easypay.pt/workflow/payment-notification)
$easypay = new EasyPay($payment_info); $xml = $easypay->processPaymentInfo(); //do your code here if needed return \Response::make($xml, '200')->header('Content-Type', 'text/xml'); //must return in text/xml for easypay
This block of code will store into database the document number of the payment received from easypay, update with more info sent from them and return xml to easypay. (Step 4 : https://docs.easypay.pt/workflow/payment-notification)
Get all payments
This will return an array with all of your payments from easypay
$easypay = new EasyPay(); $all_payments = $easypay->fetchAllPayments();
and thats it ....
Credits
Hugo Neto
kanazaca/easypay 适用场景与选型建议
kanazaca/easypay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.34k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kanazaca/easypay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kanazaca/easypay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-01