1. Go to this page and download the library: Download bobospay/bobospay-php 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/ */
bobospay / bobospay-php example snippets
// 1. Load Guzzle (adjust the path to match your setup)
-php/autoload.php';
use Bobospay\BobospayClient;
use Bobospay\DTOs\CreateTransactionDTO;
use Bobospay\Exceptions\ApiException;
$bobospay = new BobospayClient('ci_live_your_client_id', 'your_client_secret');
try {
$response = $bobospay->transactions()->create(new CreateTransactionDTO(
amount: 1500.00,
currency: 'NGN',
callbackUrl: 'https://yoursite.com/payment/callback',
note: 'Order #1234',
));
$token = $bobospay->transactions()->generateToken($response['data']['id']);
header('Location: ' . $token['data']['url']);
exit;
} catch (ApiException $e) {
echo 'Payment error: ' . $e->getMessage();
}
use Bobospay\BobospayClient;
use Bobospay\DTOs\CreateTransactionDTO;
$bobospay = new BobospayClient(
'ci_live_your_client_id',
'your_client_secret',
);
// Create a transaction
$response = $bobospay->transactions()->create(new CreateTransactionDTO(
amount: 1500.00,
currency: 'NGN',
callbackUrl: 'https://yoursite.com/payment/callback',
note: 'Order #1234',
));
$transactionId = $response['data']['id'];
// Generate a checkout URL
$token = $bobospay->transactions()->generateToken($transactionId);
$checkoutUrl = $token['data']['url'];
// Redirect the customer to $checkoutUrl
// Sandbox -- automatically hits sandbox.bobospay.com
$bobospay = new BobospayClient('ci_test_abc123', 'your_test_secret');
// Production -- automatically hits bobospay.com
$bobospay = new BobospayClient('ci_live_abc123', 'your_live_secret');