PHP code example of byheartlk / botble-genie-payment

1. Go to this page and download the library: Download byheartlk/botble-genie-payment 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/ */

    

byheartlk / botble-genie-payment example snippets


use Botble\GeniePayment\Services\Gateways\GeniePaymentService;

$genieService = new GeniePaymentService();

$paymentData = [
    'amount' => 250.00,
    'currency' => 'LKR',
    'order_id' => [123],
    'description' => 'Package Subscription Payment',
    'customer_id' => 456,
    'customer_type' => 'App\\Models\\Customer',
    'callback_url' => route('payment.callback'),
    'return_url' => route('payment.return'),
    'address' => [
        'email' => '[email protected]',
        'name' => 'John Doe'
    ]
];

$paymentUrl = $genieService->execute($paymentData);

use Botble\GeniePayment\Models\GenieTransaction;

// Check transaction status
$transaction = GenieTransaction::findByTransactionId($transactionId);

if ($transaction->isCompleted()) {
    // Payment successful
} elseif ($transaction->isFailed()) {
    // Payment failed
} else {
    // Payment pending
}

// Webhook endpoint: POST /payment/genie/webhook
// Automatically handled by GeniePaymentController@webhook

// Manual webhook processing
$webhookData = $request->all();
$result = $genieService->processWebhook($request);

// In plugin settings
'payment_genie_payment_debug' => true

// Check logs
tail -f storage/logs/laravel.log | grep "Genie"
bash
   php artisan migrate
   
bash
# Run plugin tests
php artisan test --filter=GeniePayment

# Run with coverage
php artisan test --filter=GeniePayment --coverage