承接 thejano/zaincash-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

thejano/zaincash-laravel

最新稳定版本:1.0.0

Composer 安装命令:

composer require thejano/zaincash-laravel

包简介

A Laravel SDK for integrating with ZainCash payment gateway

README 文档

README

Introduction

ZainCash Laravel is a PHP SDK designed to integrate the ZainCash payment gateway with Laravel applications seamlessly. This package provides an easy-to-use interface for initiating and verifying payments.

Installation

You can install the package via Composer:

composer require thejano/zaincash-laravel

Configuration

After installing the package, publish the configuration file using:

php artisan vendor:publish --provider="TheJano\ZainCash\Providers\ZainCashPaymentServiceProvider"

This will create a config/zaincash.php file where you can set your credentials.

Add your credentials in your .env file:

ZAINCASH_SECRET=your_secret_key
ZAINCASH_MERCHANT_ID=your_merchant_id
ZAINCASH_MSISDN=your_phone_number
ZAINCASH_ENV=staging
ZAINCASH_REDIRECT_URL=https://yourdomain.com/payment/callback
ZAINCASH_PREFIX_ORDER_ID=ORD_

Usage

Initiate a Payment

You can initiate a payment using the ZainCashPayment facade:

use TheJano\ZainCash\Facades\ZainCashPayment;

$response = ZainCashPayment::initiatePayment(
    orderId: '12345',
    amount: 1000.00,
    serviceType: 'purchase',
    redirectUrl: 'https://yourdomain.com/payment/success'
);

$transactionId = $response['id'];
$paymentUrl = ZainCashPayment::getPaymentUrl($transactionId);

return redirect($paymentUrl);

Verify a Payment

use TheJano\ZainCash\Facades\ZainCashPayment;

$token = request('token');
$paymentData = ZainCashPayment::verifyPayment($token);

if ($paymentData) {
    // Payment is successful
} else {
    // Payment failed
}

Check Transaction Status

use TheJano\ZainCash\Facades\ZainCashPayment;

$transactionId = 'some_transaction_id';
$transactionStatus = ZainCashPayment::checkTransaction($transactionId);

Service Provider & Facade

The package registers ZainCashPaymentServiceProvider automatically. It also provides a facade ZainCashPayment for convenient usage.

License

This package is open-sourced software licensed under the MIT license.

API Documentation

For more details, visit the official API documentation:

https://docs.zaincash.iq

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-10