arifpay/phpsdk
Composer 安装命令:
composer require arifpay/phpsdk
包简介
Arifpay PHP SDK
README 文档
README
Arifpay API Package.
Documentation
See the Developer API docs.
Installation
You can install the package via composer:
composer require arifpay/arifpay
Usage
The package needs to be configured with your account's API key, which is available in the Arifpay Dashboard. Require it with the key's value. After install the package. you can use as follow.
⚠️ Since V2
Arifpay->create()is deprecated andArifpay->checkout->create()should be used.
use Arifpay\Phpsdk\Arifpay; ... $arifpay = new Arifpay('your-api-key');
Creating Checkout Session
After importing the arifpay package, use the checkout property of the Arifpay instance to create or fetch checkout sessions.
require_once 'vendor/autoload.php'; use Arifpay\Phpsdk\Arifpay; use Arifpay\Phpsdk\Helper\ArifpaySupport; use Arifpay\Phpsdk\Lib\ArifpayBeneficary; use Arifpay\Phpsdk\Lib\ArifpayCheckoutItem; use Arifpay\Phpsdk\Lib\ArifpayCheckoutRequest; use Arifpay\Phpsdk\Lib\ArifpayOptions; $arifpay = new Arifpay('your-api-key'); $expired = "2023-01-13T17:09:42.411"; $data = new ArifpayCheckoutRequest( cancel_url: 'https://api.arifpay.com', error_url: 'https://api.arifpay.com', notify_url: 'https://gateway.arifpay.net/test/callback', expireDate: $expired, nonce: floor(rand() * 10000) . "", beneficiaries: [ ArifpayBeneficary::fromJson([ "accountNumber" => '01320811436100', "bank" => 'AWINETAA', "amount" => 10.0, ]), ], paymentMethods: ["CARD"], success_url: 'https://gateway.arifpay.net', items: [ ArifpayCheckoutItem::fromJson([ "name" => 'Bannana', "price" => 10.0, "quantity" => 1, ]), ], ); $session = $arifpay->checkout->create($data, new ArifpayOptions(sandbox: true)); echo $session->session_id;
Getting Session by Session ID
To track the progress of a checkout session you can use the fetch method as shown below:
$arifpay = new Arifpay('API KEY...'); // A sessionId will be returned when creating a session. $session = $arifpay->checkout->fetch('checkOutSessionID', new ArifpayOptions(true));
The following object represents a session
{
public int $id,
public ArifpayTransaction $transcation,
public float $totalAmount,
public bool $test,
public string $uuid,
public string $created_at,
public string $update_at
}
Cancel Session by Session ID
If the merchant want to cancel a checkout session. it's now possible as shown below.
$arifpay = new Arifpay('API KEY...'); // A sessionId will be returned when creating a session. $session = $arifpay->checkout->cancel('checkOutSessionID', new ArifpayOptions(true));
The ArifpayCheckoutSession class is returned.
DirectPay
learn more about DirectPay here
DirectPay for telebirr
$session = $arifpay->checkout->create($data, new ArifpayOptions(true)); return $arifpay->directPay->telebirr->pay($session->session_id);
DirectPay for awash wallet
$session = $arifpay->checkout->create($data, new ArifpayOptions(true)); return $arifpay->directPay->awash_wallet->pay($session->session_id);
DirectPay for awash
$session = $arifpay->checkout->create($data, new ArifpayOptions(true)); return $arifpay->directPay->awash->pay($session->session_id);
Change Log
Released Date: v1.1.1 Oct 03, 2022
- Initial Release
More Information
Credits
License
The MIT License (MIT). Please see License File for more information.
arifpay/phpsdk 适用场景与选型建议
arifpay/phpsdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arifpay/phpsdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arifpay/phpsdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-04