承接 asciisd/kashier 相关项目开发

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

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

asciisd/kashier

Composer 安装命令:

composer require asciisd/kashier

包简介

A Laravel package for Kashier payment gateway integration

README 文档

README

Latest Version on Packagist Software License Total Downloads

Kashier Payment Gateway for Laravel

A Laravel package for integrating with the Kashier payment gateway in your Laravel applications.

Overview

This package provides a simple and elegant way to integrate Kashier payment processing into your Laravel applications. It handles payment requests, callbacks, and webhooks with minimal configuration.

Features

  • Easy integration with Kashier payment gateway
  • Support for multiple payment methods (cards, wallets, bank installments)
  • Secure payment processing with hash verification
  • Webhook handling for payment notifications
  • Response handling for payment callbacks
  • Event-driven architecture for custom payment processing logic

Installation

You can install the package via composer:

composer require asciisd/kashier

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="Asciisd\\Kashier\\Providers\\KashierServiceProvider" --tag="config"

Then, set your Kashier credentials in your .env file:

KASHIER_MID=your-merchant-id
KASHIER_API_KEY=your-api-key
KASHIER_SECRET_KEY=your-secret-key
KASHIER_MODE=test # or live
KASHIER_CURRENCY=EGP # or any other supported currency
KASHIER_CALLBACK_URL=https://your-website.com/payment-complete # optional custom redirect URL

Usage

Basic Payment Processing

use Asciisd\Kashier\Facades\Kashier;

// Generate a payment URL
$paymentUrl = Kashier::buildPaymentUrl(
    amount: 100, // Amount in the smallest currency unit (e.g., piasters for EGP)
    orderId: 'order-123', // Your unique order ID
    attributes: [
        'customerName' => 'John Doe',
        'customerEmail' => 'john@example.com',
        'customerMobile' => '01234567890',
        // Additional attributes as needed
    ]
);

// Redirect the user to the payment URL
return redirect()->away($paymentUrl);

Customizing Payment Methods

use Asciisd\Kashier\Facades\Kashier;

// Allow only specific payment methods
$paymentUrl = Kashier::setAllowedMethods('card,wallet')
    ->buildPaymentUrl(100, 'order-123');

Handling Payment Responses

The package automatically handles payment responses at the /kashier/response endpoint. You can listen for the KashierResponseHandled event to process successful payments:

use Asciisd\Kashier\Events\KashierResponseHandled;
use Illuminate\Support\Facades\Event;

Event::listen(function (KashierResponseHandled $event) {
    $paymentData = $event->payload;
    
    // Process the payment data
    // $paymentData['paymentStatus'] contains the payment status
    // $paymentData['merchantOrderId'] contains your order ID
    // ...
});

Custom Redirect After Payment

By default, users are shown a receipt page after completing payment. If you prefer to redirect users to your own custom page, you can set the KASHIER_CALLBACK_URL in your .env file:

KASHIER_CALLBACK_URL=https://your-website.com/payment-complete

When this is configured, users will be redirected to your custom URL after payment processing, with all payment data included as query parameters. This allows you to create a completely custom post-payment experience.

Handling Webhooks

Kashier will send webhook notifications to the /kashier/webhook endpoint. You can listen for the KashierWebhookHandled event to process these notifications:

use Asciisd\Kashier\Events\KashierWebhookHandled;
use Illuminate\Support\Facades\Event;

Event::listen(function (KashierWebhookHandled $event) {
    $webhookData = $event->payload;
    
    // Process the webhook data
    // Update order status, send notifications, etc.
});

Retrieving Transaction Details

use Asciisd\Kashier\Facades\Kashier;

try {
    $transactionDetails = Kashier::getTransactionDetails('order-123');
    
    // Process transaction details
    // $transactionDetails['paymentStatus'] contains the payment status
    // ...
} catch (Exception $e) {
    // Handle error
}

Security

The package automatically verifies the signature of incoming webhook and response requests to ensure they are legitimate and have not been tampered with.

Events

  • KashierResponseHandled: Dispatched when a payment response is received
  • KashierWebhookHandled: Dispatched when a webhook notification is received

License

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

asciisd/kashier 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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