PHP code example of kalimeromk / casys-laravel

1. Go to this page and download the library: Download kalimeromk/casys-laravel 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/ */

    

kalimeromk / casys-laravel example snippets


use App\Http\Controllers\CasysController;

Route::get('paymentLoader', [CasysController::class, 'index'])->name('loader');
Route::post('payment', [CasysController::class, 'getCasys'])->name('validateAndPay');
Route::post('paymentOKURL', [CasysController::class, 'success'])->name('paymentOKURL');
Route::post('paymentFailURL', [CasysController::class, 'fail'])->name('paymentFailURL');

use KalimeroMK\Casys\Controllers\RecurringPaymentController;

Route::post('/recurring-payment', [RecurringPaymentController::class, 'handleRecurringPayment'])->name('recurring.payment');

Route::get('paymentLoader', 'CasysController@index')->name('loader');
Route::post('payment', 'CasysController@getCasys')->name('validateAndPay');
Route::post('paymentOKURL', 'CasysController@success')->name('paymentOKURL');
Route::post('paymentFailURL', 'CasysController@fail')->name('paymentFailURL');

use KalimeroMK\Casys\Services\RecurringPayment;

$recurringPayment = new RecurringPayment();

$response = $recurringPayment->sendPayment(
    $merchantId,
    $rpRef,
    $rpRefId,
    $amount,
    $password
);

if ($response['success']) {
    echo "Recurring payment successful! Reference: " . $response['payment_reference'];
} else {
    echo "Recurring payment failed: " . $response['error_description'];
}
bash
php artisan vendor:publish --provider="Kalimero\Casys\CasysServiceProvider"