hopeofiran / nicardpayment
您可以使用此软件包进行Nick Card付款。
v1.0.3
2022-11-05 12:13 UTC
Requires
- php: ^7.3|^8.0
This package is auto-updated.
Last update: 2024-09-30 01:28:57 UTC
README
Laravel Parsian Refund 提供退款金额。
许可证
Laravel Persian Validation 是开源软件,根据MIT许可证授权。
要求
- Laravel 8.* 以上
- PHP 7.3 以上
安装
通过Composer
$ composer require hopeofiran/nicardpayment
配置
将以下提供者添加到 config/app.php 文件中的 providers 部分
HopeOfIran\NicardPayment\Providers\NicardPaymentProvider::class
vendor:publish
您可以通过运行 vendor:publish 命令来获取包的自定义配置文件(在 config/parsianRefund.php 路径上)
php artisan vendor:publish --provider=HopeOfIran\NicardPayment\Providers\NicardPaymentProvider
示例代码(付款)
Route::any('/payment', function () { return \HopeOfIran\NicardPayment\Facades\NicardPaymentFacade::creditAmount(200000) ->cashAmount(0) ->callbackUrl(\route('payment.verification')) ->backUrl(\route('payment.verification')) ->installmentsCountList([3, 4]) ->purchase(function (\HopeOfIran\NicardPayment\NicardPayment $nicardPayment, \Illuminate\Http\Client\Response $response, $data) { return $nicardPayment->pay($data['open_cpg_url']); return 'payment failed'; }); })->name('payment');
示例代码(验证)
Route::any('/payment/verification', function (\Illuminate\Http\Request $request) { $response = \HopeOfIran\NicardPayment\Facades\NicardPaymentFacade::verify($request->input('tid')); if ($response->successful()) { return $response['is_totally_success']; } return $response->collect()->get('status'); })->name('payment.verification');