akcybex/laravel-jazzcash
Composer 安装命令:
composer require akcybex/laravel-jazzcash
包简介
Jazzcash - Laravel Jazzcash Payment Gateway Integration
README 文档
README
Installation Steps
1. Require the Package
After creating your new Laravel application you can include the Laravel Jazzcash package with the following command:
composer require akcybex/laravel-jazzcash
2. Add the Jazzcash Merchant Sandbox or Live Credentials
Next make sure to Jazzcash Merchant Sandbox or Live credentials to your .env file & their environment to use relevant credentials:
# Jazzcash Merchant JAZZCASH_ENVIRONMENT=sandbox #You can set sandbox or live SANDBOX_JAZZCASH_MERCHANT_ID= SANDBOX_JAZZCASH_PASSWORD= SANDBOX_JAZZCASH_INTEGERITY_SALT= SANDBOX_JAZZCASH_RETURN_URL= SANDBOX_JAZZCASH_ENDPOINT=https://sandbox.jazzcash.com.pk/CustomerPortal/transactionmanagement/merchantform JAZZCASH_MERCHANT_ID= JAZZCASH_PASSWORD= JAZZCASH_INTEGERITY_SALT= JAZZCASH_RETURN_URL= JAZZCASH_ENDPOINT=https://payments.jazzcash.com.pk/CustomerPortal/transactionmanagement/merchantform
3. Run Migration
Next to run migration command to migrate jazzcash transaction table.
php artisan migrate
4. Generate MWALLET Request Form Fields, Generate form & Send Payment Request
Next to generate MWALLET request form fields from your checkout details and set amount as well as send request:
Note: Currently this package is only supporting MWALLET request soon we will add other features.
// ... // Get request data after validation while submitting checkout $i = $request->all(); // will return form fields $data = \AKCybex\JazzCash\Facades\JazzCash::request()->setAmount($i['amount'])->toArray($i); // ...
Pass generated fields data to view and then paste this code in view:
{{-- ... --}}
@php
$jazzcash_environment = config('jazzcash.environment');
@endphp
<form name="redirect-to-payment-gateway" method="POST" action="{{ config("jazzcash.$jazzcash_environment.endpoint") }}">
@foreach($data as $key => $value)
<input type="hidden" name="{{ $key }}" value="{{ $value }}">
@endforeach
</form>
<script>
setTimeout(function () {
document.forms['redirect-to-payment-gateway'].submit();
}, 1000);
</script>
{{-- ... --}}
this will submit your request to jazzcash merchant and redirect automatically.
5. Handle Jazzcash response on transaction complete
Lastly, you just need to check code and get checkout details from jazzcash object which was submitted while checkout.
// ... Route::post('/jazzcash/payment', function (\Illuminate\Http\Request $request, $gateway) { $jazzcash = \AKCybex\JazzCash\Facades\JazzCash::response(); if ($jazzcash->code() == 000) { // Checkout form details you can get here $order = $jazzcash->order(); // ... } else { $error = $jazzcash->message(); // ... } }); // ...
Support
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
akcybex/laravel-jazzcash 适用场景与选型建议
akcybex/laravel-jazzcash 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 40.88k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 akcybex/laravel-jazzcash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 akcybex/laravel-jazzcash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 40.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-29