chargily/epay-php
最新稳定版本:3.0.0
Composer 安装命令:
composer require chargily/epay-php
包简介
PHP Library for Chargily ePay Gateway integration
关键字:
README 文档
README
Integrate ePayment gateway with Chargily easily.
- Currently support payment by CIB / EDAHABIA cards and soon by Visa / Mastercard
- This is a PHP package, If you are using another programing language Browse here or look to API documentation
Requirements
- PHP 7.2.5 or later.
- Get your API Key/Secret from ePay by Chargily dashboard for free.
Installation
- Via Composer (Recomended)
composer require chargily/epay-php
- Download as ZIP We do not recommend this option. But be careful to download the updated versions every a while Download
Quick start
- create config file epay_config.php This is where store your api credentials
// Configurations file return [ 'key' => 'your-api-key', // you can you found it on your epay.chargily.com.dz Dashboard 'secret' => 'your-api-secret', // you can you found it on your epay.chargily.com.dz Dashboard ];
- create payment redirection file redirect.php
use Chargily\ePay\Chargily; require 'path-to-vendor/vendor/autoload.php'; $epay_config = require 'epay_config.php'; $chargily = new Chargily([ //credentials 'api_key' => $epay_config['key'], 'api_secret' => $epay_config['secret'], //urls 'urls' => [ 'back_url' => "valid-url-to-redirect-after-payment", // this is where client redirected after payment processing 'webhook_url' => "valid-url-to-receive-payment-informations", // this is where you receive payment informations ], //mode 'mode' => 'EDAHABIA', //OR CIB //payment details 'payment' => [ 'number' => 'payment-number-from-your-side', // Payment or order number 'client_name' => 'client name', // Client name 'client_email' => 'client_email@mail.com', // This is where client receive payment receipt after confirmation 'amount' => 75, //this the amount must be greater than or equal 75 'discount' => 0, //this is discount percentage between 0 and 99 'description' => 'payment-description', // this is the payment description ] ]); // get redirect url $redirectUrl = $chargily->getRedirectUrl(); //like : https://epay.chargily.com.dz/checkout/random_token_here // if($redirectUrl){ //redirect header('Location: '.$redirectUrl); }else{ echo "We cant redirect to your payment now"; }
- create payment processing file process.php
use Chargily\ePay\Chargily; require 'path-to-vendor/vendor/autoload.php'; $epay_config = require 'epay_config.php'; $chargily = new Chargily([ //credentials 'api_key' => $epay_config['key'], 'api_secret' => $epay_config['secret'], ]); if ($chargily->checkResponse()) { $response = $chargily->getResponseDetails(); //@ToDo: Validate order status by $response['invoice']['invoice_number']. If it is not already approved, approve it. //something else /* $response like the follwing array $response = array( "invoice" => array( "id" => 5566321, "client" => "Client name", "invoice_number" => "123456789", "due_date" => "2022-01-01 00:00:00", "status" => "paid", "amount" => 75, "fee" => 25, "discount" => 0, "comment" => "Payment description", "tos" => 1, "mode" => "EDAHABIA", "invoice_token" => "randoom_token_here", "due_amount" => 10000, "created_at" => "2022-01-01 06:10:38", "updated_at" => "2022-01-01 06:13:00", "back_url" => "https://www.mydomain.com/success", "new" => 1, ); ) */ exit('OK'); }
- Guide for testing your webhook (process) url Click Here
Configurations
- Available Configurations
| key | description | redirect url | process url |
|---|---|---|---|
| api_key | must be string given by organization | required | required |
| api_secret | must be string given by organization | required | required |
| urls | must be array | required | not required |
| urls[back_url] | must be string and valid url | required | not required |
| urls[process_url] | must be string and valid url | required | not required |
| mode | must be in CIB,EDAHABIA | required | not required |
| payment[number] | must be string or int | required | not required |
| payment[client_name] | must be string | required | not required |
| payment[client_email] | must be string and valid email This is where client receive payment receipt after confirmation | required | not required |
| payment[amount] | must be numeric and greather or equal than 75 | required | not required |
| payment[discount] | must be numeric and between 0 and 99.99 (discount percentage) | required | not required |
| payment[description] | must be string | required | not required |
| options | must be array | required | not required |
| options[headers] | must be array | required | not required |
| options[timeout] | must be numeric | required | not required |
Notice
- If you faced Issues Click here to open one
chargily/epay-php 适用场景与选型建议
chargily/epay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.23k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2022 年 07 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「epay」 「chargily」 「epay.chargily.com.dz」 「epaiment」 「Chargily-ePay-Gateway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chargily/epay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chargily/epay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chargily/epay-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
VUB eplatby driver for the Omnipay payment processing library
PHP Library for Chargily Pay V2
Laravel-Chargily-ePay is a Laravel package that provides an easy interface to Chargily ePay gateway
Epay.bg API wrapper for Laravel 5.*
Alfabank REST API integration
This is epay package
统计信息
- 总下载量: 3.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-17
