PHP code example of ilebora / borawallet

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

    

ilebora / borawallet example snippets



LEBORA\BoraWallet;

try {
    // Option 1: Using the constructor to load from environment variables
    $wallet = new BoraWallet();

    // Option 2: Alternatively, set credentials using setters
    // $wallet = (new BoraWallet())
    //     ->setApiKey('your_api_key')
    //     ->setUserID('your_user_id')
    //     ->setDisplayName('your_display_name');

    // Option3: Set the API version you are taregeting
    // $wallet->setApiVersion('1.1');

    // Set other properties
    $wallet->setPhone('0113703323')
        ->setAmount(250)
         // ->setBackLink('https://yourdomain.com/back')
        // ->setOnSuccess('success_callback_url')
        // ->setOnFailure('failure_callback_url')
        ;

    // Generate
    $formHtml = $wallet->getCheckoutForm();

    // Handle the response
    echo $formHtml;

} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}