PHP code example of laraditz / xenopay

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

    

laraditz / xenopay example snippets


'providers' => [
    ...
    Laraditz\Xenopay\XenopayServiceProvider::class,
    ...
],

// using Facade
$response = \Xenopay::auth()->login(['email' => '[email protected]', 'password' => 'password']);

// using Service Container
$response = app('Xenopay')->auth()->login(['email' => '[email protected]', 'password' => 'password']);

// login
$response = \Xenopay::auth()->login(); // if u have set default account in .env, do not need to pass anything

// create bill
$response = \Xenopay::bill()->withToken($access_token)->create([
    'ref_no' => 'youruniquereferenceno',
    'amount' => 1,
    'description' => 'your description here.',
    'contact' => '0121234567',
    'redirect_url' => 'https://yourapp.com',
]);

// view bill
$response = \Xenopay::bill()->withToken($access_token)->view($id);

$response->isSuccess() : bool; // true or false

$response->status() : int; // http status code. e.g. 200, 400, 500 etc.

$response->message() : string; // message for the response. e.g. "Invalid data".

$response->data() : mixed; // response content

$response->errors() : array; // usually contain validation errors
bash
php artisan migrate