PHP code example of koderia-creative-lab / laravel-xpresspay

1. Go to this page and download the library: Download koderia-creative-lab/laravel-xpresspay 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/ */

    

koderia-creative-lab / laravel-xpresspay example snippets


use Koderia\XpressPay\Facades\XpressPay;

$response = XpressPay::initialize([
    'amount'             => '15000',
    'transactionId'      => 'UNIQUE_TX_REF',
    'email'              => '[email protected]',
    'payerName'          => 'Ada Lovelace',
    'productDescription' => 'Tuition Fee',
    'metadata'           => ['order_id' => 102],
]);

if ($response->isSuccessful()) {
    return redirect($response->getPaymentUrl());
}

$error = $response->getErrorMessage();

use Koderia\XpressPay\Facades\XpressPay;

$verification = XpressPay::verify($transactionId);

if ($verification->isApproved()) {
    $amount   = $verification->getAmount();
    $metadata = $verification->getMetadata();
}
bash
php artisan vendor:publish --tag="xpresspay-config"