codepreneur/casys-pay

Reusable Casys VPOS payment integration for Laravel.

Maintainers

Package info

github.com/kodpreneur-dooel/casys-pay

pkg:composer/codepreneur/casys-pay

Statistics

Installs: 35

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.3 2026-03-31 15:55 UTC

This package is auto-updated.

Last update: 2026-03-31 15:55:55 UTC


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.