定制 akcybex/laravel-jazzcash 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akcybex/laravel-jazzcash

最新稳定版本:1.0

Composer 安装命令:

composer require akcybex/laravel-jazzcash

包简介

Jazzcash - Laravel Jazzcash Payment Gateway Integration

README 文档

README



Jazzcash

Build Status Total Downloads Latest Stable Version License

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

Contact Us

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.

统计信息

  • 总下载量: 36.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-29