paystar / laravel-ipg
适用于PayStar支付网关和重视时间的用户
v1.0.1
2023-02-07 19:11 UTC
Requires
- php: 7.*|8.*
- laravel/framework: 7.*|8.*|9.*
README
这是一个适用于PayStar支付网关的Laravel包。
⬇️ 安装指南
安装包
composer require paystar/laravel-ipg
发布配置
php artisan vendor:publish --tag=paystar-ipg
📖 可用方法列表
create()
:返回一个令牌payment()
:自动跳转到网关verify()
:验证交易
✔️ 如何使用存在的方法和选项
-
使用
create()
方法<?php use PayStar\Ipg\Facades\PayStarIpg; PayStarIpg::amount('AMOUNT') // * ->orderId('ORDER_ID') // * ->callbackUrl('CALLBACK_URL') // If You don't use this method, we set this from config ->sign('SIGN') // If You don't use this method, we generate auto a sign ->create();
额外选项列表
如何使用这些选项
<?php use PayStar\Ipg\Facades\PayStarIpg; PayStarIpg::amount('AMOUNT') // * ->orderId('ORDER_ID') // * ->callbackUrl('CALLBACK_URL') // If You don't use this method, we set this from config ->sign('SIGN') // If You don't use this method, we generate auto a sign ->option([ 'name' => 'Name', 'phone' => 'PHONE', 'mail' => 'MAIL', 'description' => 'DESCRIPTION', 'allotment' => 'ALLOTMENT', 'callback_method' => 'CALLBACK_METHOD', 'wallet_hashid' => 'WALLET_HASHID', 'national_code' => 'NATIONAL_CODE', ]) ->create();
-
使用
verify()
方法<?php use PayStar\Ipg\Facades\PayStarIpg; PayStarIpg::amount('AMOUNT') ->refNum('REF_NUM') ->sign('SIGN') ->verify();
-
使用
payment()
方法<?php use PayStar\Ipg\Facades\PayStarIpg; // Redirect to Gateway PayStarIpg::token('TOKEN')->payment();
如何生成sign
<?php use PayStar\Ipg\Facades\Encryption; // The Encryption Facade has 3 methods Encryption::sign($amount, $orderId, $callbackUrl); // Generate a sign with set algorithm in config file Encryption::algos(); // Show list of hash Algorithms (hash_algos() method) Encryption::hash($algo, $string, $key, $binary); // use hash_hmac() method