santosdave/pesawise-wrapper
Composer 安装命令:
composer require santosdave/pesawise-wrapper
包简介
A Laravel package for integrating Pesawise payment gateway
README 文档
README
A Laravel package for integrating the Pesawise payment gateway into your application.
Installation
You can install the package via composer:
composer require santosdave/pesawise-wrapper
Configuration
After installation, publish the config file:
php artisan vendor:publish --provider="Santosdave\PesawiseWrapper\PesawiseProvider"
This will create a config/pesawise.php file. Update your .env file with your Pesawise credentials:
PESAWISE_API_KEY=your_api_key
PESAWISE_API_SECRET=your_api_secret
PESAWISE_ENVIRONMENT=sandbox
PESAWISE_DEBUG=false
PESAWISE_DEFAULT_CURRENCY=KES
PESAWISE_DEFAULT_BALANCE_ID=your_default_balance_id
Usage
You can use the Pesawise facade or inject the Pesawise class into your controllers/services.
use Santosdave\PesawiseWrapper\Facades\Pesawise; // Or inject in your constructor use Santosdave\PesawiseWrapper\Pesawise; public function __construct(Pesawise $pesawise) { $this->pesawise = $pesawise; }
Using Dependency Injection
use Santosdave\PesawiseWrapper\Pesawise; class PaymentService { protected $pesawise; public function __construct(Pesawise $pesawise) { $this->pesawise = $pesawise; } public function processPayment(array $paymentData) { return $this->pesawise->createDirectPayment($paymentData); } }
Available Methods
Get All Supported Banks
$banks = Pesawise::getAllSupportedBanks();
Validate Bank Recipient
use Santosdave\PesawiseWrapper\Requests\BankRecipientValidationRequest; $request = new BankRecipientValidationRequest( bankId: 1, bankAccountNumber: '1234567890' ); $recipient = Pesawise::validateBankRecipient($request);
Create Bulk Payment
use Santosdave\PesawiseWrapper\Requests\BulkPaymentRequest; use Santosdave\PesawiseWrapper\DataTypes\Currency; use Santosdave\PesawiseWrapper\DataTypes\BulkPayment; use Santosdave\PesawiseWrapper\DataTypes\TransferType; $bulkPayments = [ new BulkPayment( amount: 1000, transferType: new TransferType(TransferType::BANK), reference: 'REF123', recipient: 'John Doe', bankId: 1, accountNumber: '1234567890' ) ]; $request = new BulkPaymentRequest( balanceId: 1001002, currency: new Currency(Currency::KES), bulkPayments: $bulkPayments ); $bulkPayment = Pesawise::createBulkPayment($request);
Create Payment Order
$order = Pesawise::createPaymentOrder([ 'amount' => 1000, 'customerName' => 'John Doe', 'currency' => 'KES', 'externalId' => 'ORDER123', 'description' => 'Product purchase', 'balanceId' => 1001002, 'callbackUrl' => 'https://example.com/callback' ]);
Complete Payment
use Santosdave\PesawiseWrapper\Requests\CompletePaymentRequest; $request = new CompletePaymentRequest( paymentId: 'payment_id_here', otp: '123456' ); $payment = Pesawise::completePayment($request);
Create Direct Payment
$payment = Pesawise::createDirectPayment([ 'balanceId' => 1001002, 'currency' => 'KES', 'amount' => 1000, 'transferType' => 'BANK', 'reference' => 'REF123', 'recipient' => 'John Doe', 'bankId' => 1, 'accountNumber' => '1234567890' ]);
For more methods and detailed usage, refer to the Pesawise API documentation.
Error Handling
The package throws PesawiseException for API errors. You can catch and handle these exceptions in your application:
use Santosdave\PesawiseWrapper\Exceptions\PesawiseException; try { $payment = Pesawise::createDirectPayment([...]); } catch (PesawiseException $e) { $errorMessage = $e->getMessage(); $errorCode = $e->getCode(); $errorResponse = $e->getErrorResponse(); // Handle the error }
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email the author instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
santosdave/pesawise-wrapper 适用场景与选型建议
santosdave/pesawise-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 61 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payments」 「santosdave」 「pesawise-wrapper」 「pesawise」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 santosdave/pesawise-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 santosdave/pesawise-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 santosdave/pesawise-wrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Laravel wrapper for Sabre APIs
Laravel package for Verteil NDC API integration
Comprehensive Laravel package for JamboJet's NSK API integration
Scanpay module for Magento 2
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-25