定制 zfhassaan/jazzcash 二次开发

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

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

zfhassaan/jazzcash

Composer 安装命令:

composer require zfhassaan/jazzcash

包简介

JazzCash Payment Gateway Package for Laravel 8+

README 文档

README

JazzCash Payment Gateway

Latest Version on Packagist MIT Licensed Total Downloads Tests Laravel PHP

Disclaimer

This is unofficial Jazzcash API Payment Gateway. This repository is only created to help developers in streamlining the integration process. You can Review the Official Payment Gateway here. This Package only processes hosted checkout process. There's no Subscription option enabled yet.

About

JazzCash is a leading payment gateway in Pakistan that allows businesses to securely accept online payments from their customers. With fast and reliable transaction processing, advanced fraud protection, and a user-friendly interface, JazzCash makes it easy for merchants to grow their online sales. Whether you're a small business owner, e-commerce store owner, or a developer looking to integrate a payment gateway into your website or mobile app, JazzCash has a solution that fits your needs. This document contains a detailed explanation of how to integrate with JazzCash's hosted checkout feature (version 1.0.0).

Intended Audience

This document is for merchants and developers who want to integrate with JazzCash to perform a hosted checkout.

Integration Scope

The merchant will implement all e-commerce functionality. The JazzCash service will only be used for payment processing with the hosted checkout feature.

API End Points

This package only contains the hosted checkout process. There are no API endpoints specified for direct checkout.

Integration Prerequisites

Merchants must be registered with JazzCash prior to integration. After signing up for a JazzCash account, the merchant will receive the following unique values to operate: Merchant_ID, Password, Hashkey, Sandbox URL, and Production URL. These keys are used to get a one-time authentication token, which

Requirements

Component Supported versions
PHP 7.3 – 8.5
Laravel 8.x – 13.x

Laravel 8–12 use package auto-discovery. On Laravel 8 you can still register the provider and facade manually (see configuration).

Installation

You can install the package via composer

composer require zfhassaan/jazzcash

Set .env configurations

JAZZCASH_PAYMENTMODE=sandbox
JAZZCASH_MERCHANTID=
JAZZCASH_PASSWORD=
JAZZCASH_HASHKEY=
JAZZCASH_MPIN=
JAZZCASH_PRODUCTION_URL=
JAZZCASH_SANDBOX_URL=
JAZZCASH_RETURNURL=

configuration

In your config/app.php file, add the following line to the providers array:

    /*
    * Package Service Providers...
    */

    \zfhassaan\jazzcash\provider\ServiceProvider as JazzcashServiceProvider;

In the aliases array of the same file, add the following line:

  'aliases' => Facade::defaultAliases()->merge([
        'Jazzcash' => \Zfhassaan\Jazzcash\Facade\JazzcashFacade::class,
    ])->toArray(),

Publish Vendor:

Publish the package assets by running the following command:

php artisan vendor:publish 

This will show the following response in terminal: img.png

press 9 to publish zfhassaan\jazzcash\provider\ServiceProvider provider

Steps:

Hosted Checkout

To initiate the hosted checkout process, send a POST request with the following parameters:

{
    "amount":"1",
    "billref":"bill-reference",
    "productDescription": "Product Description"
}

Then, in your controller, use the following code:

        $jazzcash = new JazzCash();
        $jazzcash->setAmount($request->amount);
        $jazzcash->setBillReference($request->billref);
        $jazzcash->setProductDescription($request->productDescription);
        return $jazzcash->sendRequest();

The index function is called and a new instance of the JazzCash class is created. The setAmount, setBillReference, and setProductDescription methods are called on the JazzCash object, passing in the amount, billref, and productDescription values from the request as arguments. These methods set the corresponding properties of the JazzCash object to the specified values.

The sendRequest method is called on the JazzCash object. This method sends a request to the JazzCash API to initiate the checkout process and returns the response from the API as an HTML template which can be rendered on the web and mobile application. To hide or show fields, you can use CSS to control the field's visibility on the frontend.

The response from the API is returned by the index function. This response can be used to display the hosted checkout form on your website or mobile app.

Testing

To test the payment gateway, you can use the sandbox mode by setting JAZZCASH_PAYMENTMODE=sandbox in your .env file. This will allow you to test the checkout process without actually processing any payments.

To switch to production mode, set JAZZCASH_PAYMENTMODE=production in your .env file.

Changelog

Please see Changelog for more information what has changed recently.

Security

The following lines are taken from briandk repository for contributing in an open source projects.

Great Bug Reports tend to have:

  • A quick summary and/or background
  • Steps to reproduce
    • Be specific!
    • Give sample code if you can. An issue includes sample code that anyone with a base R setup can run to reproduce what I was seeing
  • What you expected would happen
  • What actually happens
  • Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

License

The MIT License (MIT). Please see License File for more information.

zfhassaan/jazzcash 适用场景与选型建议

zfhassaan/jazzcash 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.48k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2023 年 01 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 zfhassaan/jazzcash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zfhassaan/jazzcash 我们能提供哪些服务?
定制开发 / 二次开发

基于 zfhassaan/jazzcash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-01