codepreneur/casys-pay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

codepreneur/casys-pay

最新稳定版本:1.3

Composer 安装命令:

composer require codepreneur/casys-pay

包简介

Reusable Casys VPOS payment integration for Laravel.

README 文档

README

Reusable Casys VPOS payment integration for Laravel applications and packages.

Installation

Install the package via Composer:

composer require codepreneur/casys-pay

Publish the configuration file:

php artisan vendor:publish --tag="casys-config"

Optionally publish the views:

php artisan vendor:publish --tag="casys-views"

For package development, this repository now ships with an Orchestra Testbench workbench and Laravel Boost:

composer install
php artisan boost:install

If Codex MCP support is not registered automatically, add it from the package root:

codex mcp add laravel-boost -- php artisan boost:mcp

Configuration

Set these environment variables in the consuming app or workbench:

CASYS_MERCHANT_ID=
CASYS_MERCHANT_NAME=
CASYS_CURRENCY=MKD
CASYS_PASSWORD=
CASYS_PAYMENT_URL=https://vpos.cpay.com.mk/mk-MK
CASYS_SUCCESS_URL=/casys/success
CASYS_FAIL_URL=/casys/fail
CASYS_SUCCESS_VIEW=
CASYS_FAIL_VIEW=

Usage

Build a payment payload:

use Codepreneur\CasysPay\Contracts\CasysClientInterface;

$payload = app(CasysClientInterface::class)->buildPayload([
    'amount' => 1200,
    'details1' => (string) $order->id,
    'details2' => (string) now()->timestamp,
    'customer' => [
        'first_name' => $order->customer_first_name,
        'last_name' => $order->customer_last_name,
        'email' => $order->customer_email,
        'phone' => $order->customer_phone,
    ],
]);

Render the hosted payment form:

@include('casys::casys.form', [
    'paymentUrl' => config('casys.payment_url'),
    'payload' => $payload->toArray(),
])

Handling callbacks

Listen for the success and failure events dispatched by the package:

use Codepreneur\CasysPay\Events\CasysPaymentFailed;
use Codepreneur\CasysPay\Events\CasysPaymentSucceeded;
use Illuminate\Support\Facades\Event;

Event::listen(CasysPaymentSucceeded::class, function ($event) {
    // update order or membership state
});

Event::listen(CasysPaymentFailed::class, function ($event) {
    // mark the payment attempt as failed
});

Testing

Run the test suite with:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

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

统计信息

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

GitHub 信息

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

其他信息

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