1. Go to this page and download the library: Download bowphp/payment 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/ */
use Bow\Payment\UserPayment;
class User extends Model
{
use UserPayment;
}
// Now you can use payment methods on your user model
$user->payment(1000, 'ORDER-123');
$user->transfer(5000, 'TRANSFER-456');
use Bow\Payment\Support\RetryHandler;
$retry = new RetryHandler(
maxAttempts: 3,
retryDelay: 1000,
exponentialBackoff: true
);
$result = $retry->execute(function() use ($payment) {
return $payment->pay($amount);
});
use Bow\Payment\Support\RateLimiter;
$limiter = new RateLimiter(
maxRequests: 60,
timeWindow: 60
);
if ($limiter->isAllowed('orange')) {
$limiter->hit('orange');
// Make API call
}
use Bow\Payment\Support\TransactionLogger;
$logger = new TransactionLogger('/path/to/logs');
// Logs are automatically created with detailed context
$logger->logPaymentRequest('mtn', [
'amount' => 1000,
'reference' => 'ORDER-123'
]);
$logger->logPaymentResponse('mtn', true, $response);
use Bow\Payment\Webhook\WebhookHandler;
$handler = new WebhookHandler('orange', $config['webhook_secret']);
$request = WebhookHandler::parseRequest();
$event = $handler->handle($request['payload'], $request['signature']);
if ($event->isPaymentSuccess()) {
$transactionId = $event->getTransactionId();
$amount = $event->getAmount();
// Update order status
}
// Start with Orange Money
Payment::configure($config);
// Switch to MTN for a specific transaction
Payment::useProvider('ci', Payment::MTN);
Payment::payment($data);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.