PHP code example of codepreneur / casys-pay

1. Go to this page and download the library: Download codepreneur/casys-pay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codepreneur / casys-pay example snippets


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,
    ],
]);

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
});
bash
php artisan vendor:publish --tag="casys-config"
bash
php artisan vendor:publish --tag="casys-views"
bash
composer install
php artisan boost:install
bash
codex mcp add laravel-boost -- php artisan boost:mcp