PHP code example of ibracilinks / orange-money

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

    

ibracilinks / orange-money example snippets


use Ibracilinks\OrangeMoney\Exceptions\OrangeMoneyException;
use Ibracilinks\OrangeMoney\Facades\OrangeMoney;

try {
    $payment = OrangeMoney::webPayment([
        'order_id' => 'order-123', // optional, generated when omitted
        'amount' => 5000,
        'lang' => 'fr',
        'reference' => 'Your Website',
    ]);
} catch (OrangeMoneyException $e) {
    report($e);

    return back()->withErrors('The payment could not be started.');
}

// Save order_id, pay_token and notif_token with your order before redirecting.
return redirect()->away($payment['payment_url']);

$status = OrangeMoney::checkTransactionStatus('order-123', 5000, $payToken);

use Ibracilinks\OrangeMoney\OrangeMoney;

$service = app(OrangeMoney::class);
$service = new OrangeMoney(['currency' => 'OUV']);
bash
php artisan vendor:publish --tag=orangemoney-config