PHPackages                             bowphp/payment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. bowphp/payment

ActiveLibrary[Payment Processing](/categories/payments)

bowphp/payment
==============

The payment gateway for Bow Framework

v0.0.1(6y ago)83091[1 issues](https://github.com/bowphp/payment/issues)MITPHP

Since Jan 23Pushed 4w agoCompare

[ Source](https://github.com/bowphp/payment)[ Packagist](https://packagist.org/packages/bowphp/payment)[ RSS](/packages/bowphp-payment/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Bow Payment
===========

[](#bow-payment)

[![Documentation](https://camo.githubusercontent.com/b94553a577ad040c07545f85231121534da3cd2c832358da04aa3bd99d6015b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d72656164253230646f63732d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/bowphp/docs/blog/master/payment.md)[![Latest Version](https://camo.githubusercontent.com/ada993bbc95fbfc148e636366bba30af64ee914aef5cf033e436ef0c1ff41999/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f777068702f7061796d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bowphp/payment)[![License](https://camo.githubusercontent.com/7123c32787e013be5a8a13598ad01f562754637ed6141e89b02e85bf16d3e63e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e7376673f7374796c653d666c61742d737175617265)](https://github.com/bowphp/payment/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/933f012f63381f50ccbf5003d44f7019ec507e7c59f0bcafabcadecc3f2842ad/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f626f777068702f7061796d656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bowphp/payment)

The comprehensive payment gateway for Bow Framework. Built to make integrating African mobile money payment providers seamless, secure, and reliable.

Introduction
------------

[](#introduction)

This package helps developers easily integrate local mobile payment APIs such as **Orange Money**, **Moov Money** (commonly called **Flooz**), **MTN Mobile Money**, **Wave**, and **Djamo** with advanced features like retry logic, rate limiting, transaction logging, and webhook handling.

### Supported Providers

[](#supported-providers)

- ✅ **Orange Money** (Ivory Coast) - Fully implemented
- ✅ **MTN Mobile Money** (Ivory Coast) - Fully implemented
- 📦 **Moov Money (Flooz)** - Gateway ready, pending API documentation
- 📦 **Wave** - Gateway ready, pending API documentation
- 📦 **Djamo** - Gateway ready, pending API documentation

Installation
------------

[](#installation)

Install the package using `composer`, the PHP package manager:

```
composer require bowphp/payment
```

Quick Start
-----------

[](#quick-start)

### Configuration

[](#configuration)

Configure your payment providers in your `config/payment.php`:

```
use Bow\Payment\Payment;

return [
    'default' => [
        'gateway' => Payment::ORANGE,
        'country' => 'ivory_coast',
    ],

    'ivory_coast' => [
        'orange' => [
            'client_key' => env('ORANGE_CLIENT_KEY'),
            'client_secret' => env('ORANGE_CLIENT_SECRET'),
            'webhook_secret' => env('ORANGE_WEBHOOK_SECRET'),
        ],
        'mtn' => [
            'subscription_key' => env('MTN_SUBSCRIPTION_KEY'),
            'api_user' => env('MTN_API_USER'),
            'api_key' => env('MTN_API_KEY'),
            'environment' => 'sandbox', // or 'production'
            'webhook_secret' => env('MTN_WEBHOOK_SECRET'),
        ],
        // Other providers...
    ],
];
```

### Basic Usage

[](#basic-usage)

```
use Bow\Payment\Payment;

// Configure the payment gateway
$gateway = Payment::configure($config);

// Make a payment
$gateway->payment([
    'amount' => 1000,
    'phone_number' => '+225070000001',
    'reference' => 'ORDER-123',
    'options' => [
        'notif_url' => 'https://your-app.com/webhook',
        'return_url' => 'https://your-app.com/success',
        'cancel_url' => 'https://your-app.com/cancel',
    ]
]);

// Verify a transaction
$status = $gateway->verify([
    'reference' => 'ORDER-123',
    'options' => [
        //
    ]
]);

if ($status->isSuccess()) {
    // Payment successful
}
```

### Using with Models

[](#using-with-models)

Add the `UserPayment` trait to your User model:

```
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');
```

Advanced Features
-----------------

[](#advanced-features)

### Retry Logic

[](#retry-logic)

Automatically retry failed API calls with exponential backoff:

```
use Bow\Payment\Support\RetryHandler;

$retry = new RetryHandler(
    maxAttempts: 3,
    retryDelay: 1000,
    exponentialBackoff: true
);

$result = $retry->execute(function() use ($payment) {
    return $payment->pay($amount);
});
```

### Rate Limiting

[](#rate-limiting)

Protect your application from exceeding API rate limits:

```
use Bow\Payment\Support\RateLimiter;

$limiter = new RateLimiter(
    maxRequests: 60,
    timeWindow: 60
);

if ($limiter->isAllowed('orange')) {
    $limiter->hit('orange');
    // Make API call
}
```

### Transaction Logging

[](#transaction-logging)

Comprehensive audit trail for all payment operations:

```
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);
```

### Webhook Handling

[](#webhook-handling)

Secure webhook processing with signature validation:

```
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
}
```

### Exception Handling

[](#exception-handling)

Comprehensive custom exceptions for better error handling:

```
use Bow\Payment\Exceptions\PaymentRequestException;
use Bow\Payment\Exceptions\RateLimitException;
use Bow\Payment\Exceptions\TokenGenerationException;

try {
    Payment::payment($data);
} catch (RateLimitException $e) {
    // Rate limit exceeded
    $retryAfter = $e->getCode();
} catch (PaymentRequestException $e) {
    // Payment request failed
    Log::error($e->getMessage());
} catch (TokenGenerationException $e) {
    // Token generation failed
}
```

Provider-Specific Usage
-----------------------

[](#provider-specific-usage)

### Orange Money

[](#orange-money)

```
Payment::configure([
    'default' => [
        'gateway' => Payment::ORANGE,
        'country' => 'ci',
    ],
    'ivory_coast' => [
        'orange' => [
            'client_key' => 'YOUR_CLIENT_KEY',
            'client_secret' => 'YOUR_CLIENT_SECRET',
        ],
    ],
]);

$result = Payment::payment([
    'amount' => 1000,
    'reference' => 'ORDER-123',
    'options' => [
        'notif_url' => 'https://your-app.com/webhook',
        'return_url' => 'https://your-app.com/success',
        'cancel_url' => 'https://your-app.com/cancel',
    ],
]);
```

### MTN Mobile Money

[](#mtn-mobile-money)

```
Payment::configure([
    'default' => [
        'gateway' => Payment::MTN,
        'country' => 'ci',
    ],
    'ivory_coast' => [
        'mtn' => [
            'subscription_key' => 'YOUR_SUBSCRIPTION_KEY',
            'api_user' => 'YOUR_API_USER',
            'api_key' => 'YOUR_API_KEY',
            'environment' => 'sandbox',
        ],
    ],
]);

$result = Payment::payment([
    'amount' => 1000,
    'reference' => 'ORDER-123',
    'phone_number' => '0707070707',
]);

// Verify transaction
$status = Payment::verify(['reference' => $result['reference']]);

// Check balance
$balance = Payment::balance();
```

### Switching Providers Dynamically

[](#switching-providers-dynamically)

```
// Start with Orange Money
Payment::configure($config);

// Switch to MTN for a specific transaction
Payment::useProvider('ci', Payment::MTN);
Payment::payment($data);
```

Features
--------

[](#features)

- ✅ Simple, fluent API
- ✅ Multiple payment provider support (Orange Money, MTN Mobile Money)
- ✅ Dynamic provider switching
- ✅ Transaction status verification
- ✅ User model integration via traits
- ✅ Webhook handling with signature validation
- ✅ Transfer support
- ✅ Balance inquiry
- ✅ Automatic retry logic with exponential backoff
- ✅ Rate limiting protection
- ✅ Transaction audit logging
- ✅ Comprehensive exception handling
- ✅ Sandbox and production environment support

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4 (PHP 8.0+ recommended)
- Bow Framework &gt;= 4.0
- GuzzleHTTP &gt;= 6.5

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

The package includes comprehensive tests for:

- Transaction logging
- Retry logic
- Rate limiting
- Webhook handling
- Payment configuration

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

### Development Guidelines

[](#development-guidelines)

1. Follow PSR-12 coding standards
2. Add tests for new features
3. Update documentation
4. Ensure all tests pass before submitting PR

Changelog
---------

[](#changelog)

See [UPGRADE\_SUMMARY.md](UPGRADE_SUMMARY.md) for recent changes and improvements.

License
-------

[](#license)

The Bow Payment package is open-sourced software licensed under the [MIT license](LICENSE).

Support
-------

[](#support)

If you find this project helpful, consider supporting its development:

[![Buy Me A Coffee](https://camo.githubusercontent.com/e88a16e36cf3a33955f75c88798bb6bcfe3a88a97d30e4b05bbc6a2d3738b662/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f64656661756c742d626c61636b2e706e67)](https://www.buymeacoffee.com/iOLqZ3h)

Credits
-------

[](#credits)

- [Franck DAKIA](https://github.com/papac) - Lead Developer
- [All Contributors](../../contributors)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance59

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2306d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/96099e66c63e31445f3f76a12e94104030f504eeb18f007216bb4ebdcdeadf7f?d=identicon)[papac](/maintainers/papac)

---

Top Contributors

[![papac](https://avatars.githubusercontent.com/u/9353811?v=4)](https://github.com/papac "papac (91 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

bow-framworkorange-moneypaymemt-gatewaypayment

### Embed Badge

![Health badge](/badges/bowphp-payment/health.svg)

```
[![Health](https://phpackages.com/badges/bowphp-payment/health.svg)](https://phpackages.com/packages/bowphp-payment)
```

###  Alternatives

[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
