PHP code example of barkapay-sa / barkapay-laravel

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

    

barkapay-sa / barkapay-laravel example snippets


return [
    'api_key' => env('BKP_API_KEY', ''),
    'api_secret' => env('BKP_API_SECRET', ''),
    'sci_key' => env('BKP_SCI_KEY', ''),
    'sci_secret' => env('BKP_SCI_SECRET', ''),
    'base_url' => env('BKP_BASE_URL', 'https://api.barkapay.com/api/client/'),
    'currency' => 'xof',
];

$barkapay = app('barkapay');

// Service de base
$baseService = $barkapay->base();

// Service API
$apiService = $barkapay->api();

// Service SCI
$sciService = $barkapay->sci();

// Service Orange Money
$orangeMoneyService = $barkapay->orangeMoneyBF();

// Service Moov Money
$moovMoneyService = $barkapay->moovMoneyBF();

$sciService = $barkapay->sci();
$paymentLink = $sciService->createPaymentLink([
    'amount' => 10000,
    'order_id' => 'ORDER123',
    'callback_url' => 'https://example.com/callback'
]);

$apiService = $barkapay->api();
$mobilePayment = $apiService->createMobilePayment([
    'sender_country' => 'BFA',
    'operator' => 'MOOV',
    'sender_phonenumber' => '22670123456',
    'amount' => 5000,
    'order_id' => 'ORDER456',
    'callback_url' => 'https://example.com/callback'
]);

$paymentDetails = $apiService->getPaymentDetails('public_payment_id');

$orangeMoneyService = $barkapay->orangeMoneyBF();
$payment = $orangeMoneyService->proceedPayment([
    'sender_phonenumber' => '22670123456',
    'amount' => 10000,
    'otp' => '123456',
    'order_id' => 'ORDER789'
]);

$moovMoneyService = $barkapay->moovMoneyBF();
$payment = $moovMoneyService->initMobilePayment([
    'sender_phonenumber' => '22675123456',
    'amount' => 15000,
    'order_id' => 'ORDER101',
    'callback_url' => 'https://example.com/callback'
]);
sh
php artisan vendor:publish --provider="BarkapayLaravel\BarkaPayServiceProvider"
php artisan vendor:publish --tag=barkapay-config