roksta / ipay-ke
肯尼亚的iPay实现。
dev-main
2023-05-17 14:29 UTC
This package is auto-updated.
Last update: 2024-09-17 17:39:24 UTC
README
此包设计用于与Laravel一起使用。
安装
composer require roksta/ipay-ke
配置
发布配置文件以设置iPay选项。
php artisan vendor:publish --provider="Roksta\IPay\Providers\IPayServiceProvider"
使用
在您的.env文件中设置环境变量
IPAY_ENV=live or sandbox
IPAY_SECRET_KEY="your_ipay_secret_key"
IPAY_VENDOR_ID="your_ipay_vendor_id"
IPAY_MOBILE_CALLBACK_URL="https://yoursite.com/callback-url"
IPAY_CARD_CALLBACK_URL="https://yoursite.com/callback-url"
初始化iPay
$ipay = IPay::orderId(1234) ->amount(1) ->customer($phone_number, $email); $response = $ipay->initiate();
- 注意,电话号码和电子邮件不能为空。
移动STK推送
$stk_response = Ipay::stk('network')->push($phone_number, $response->data->sid);
- 注意:网络选项和sid包含在$response对象中
生成使用iPay支付的按钮
$ipay->generateForm('button_text', 'button_class')
- button_text指的是按钮中显示的文本,例如,使用IPay支付
- button_class指的是要应用到按钮上的类,例如 'btn btn-primary'
许可证
此包在MIT许可证下提供。