PHPackages                             obrainwave/paygate - 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. obrainwave/paygate

ActiveLibrary[Payment Processing](/categories/payments)

obrainwave/paygate
==================

Complete Laravel payment solution with 7 payment gateways, JavaScript SDK, advanced security, and plugin system. Unified API for Paystack, GTPay, Flutterwave, Monnify, Interswitch, Remita, and VTPass.

v2.0.7(7mo ago)2107MITPHPPHP ^8.1

Since Aug 31Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/Obrainwave/paygate)[ Packagist](https://packagist.org/packages/obrainwave/paygate)[ Docs](https://github.com/obrainwave/paygate)[ RSS](/packages/obrainwave-paygate/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (12)Versions (14)Used By (0)

Paygate v2.0.0 - Multi-Payment Gateway Laravel Package
======================================================

[](#paygate-v200---multi-payment-gateway-laravel-package)

A comprehensive Laravel package that provides a unified interface for **7 payment gateways**. Seamlessly handle payments through Paystack, GTPay, Flutterwave, Monnify, Interswitch, Remita, and VTPass with a single, consistent API.

[![Latest Version](https://camo.githubusercontent.com/dd1b51eac051b316a3173585bc64d36e19fa2d4e90a4581734cc292c175130f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e302e302d626c75652e737667)](https://github.com/obrainwave/paygate)[![Laravel](https://camo.githubusercontent.com/c038730344b69b4252ef7ca9fdebb8c4db80d8a3c78952b20222422d65653a4a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392e302532422d7265642e737667)](https://laravel.com)[![PHP](https://camo.githubusercontent.com/fb7c72456e13f7d5ecf8486e29d02a2e6775aaf4d18622a63529976b0ed0740e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d707572706c652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![Tests](https://camo.githubusercontent.com/0363107f0a65bf97aa7c32586384a049ee5754baea1591c5590f8f4d9c43fb37/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3130302532352d627269676874677265656e2e737667)](tests)

> **🎉 Version 2.0.0 is here!** Complete rewrite with 7 payment gateways, JavaScript SDK, advanced security, plugin system, and much more!

✨ Features
----------

[](#-features)

### **Payment Gateways (7 Total)**

[](#payment-gateways-7-total)

- **Paystack**: Complete payment processing with refunds
- **GTPay**: Full payment support with refunds
- **Flutterwave**: Comprehensive payment processing with refunds
- **Monnify**: Complete payment gateway with refunds
- **Interswitch**: OAuth-based payment processing with refunds
- **Remita**: Payment processing (refund via support)
- **VTPass**: Bill payments for utilities and services

### **Core Features**

[](#core-features)

- **Unified API**: Single interface for all payment gateways
- **Payment Processing**: Initiate, verify, and refund payments
- **Database Integration**: Automatic payment storage and tracking
- **Laravel Events**: Payment lifecycle event dispatching
- **Webhook Handling**: Secure webhook processing with signature verification
- **Middleware Protection**: Route protection and payment verification

### **Frontend Integration**

[](#frontend-integration)

- **JavaScript SDK**: Complete client-side payment handling
- **Blade Components**: Pre-built frontend components
- **Responsive Design**: Mobile-friendly payment forms
- **Real-time Notifications**: Built-in notification system
- **Form Validation**: Client-side validation and error handling

### **Advanced Features**

[](#advanced-features)

- **Caching System**: Redis support with configurable TTL
- **Security Suite**: Data encryption, log masking, and fraud detection
- **Plugin System**: Extensible architecture for custom features
- **Performance Optimization**: Caching, retry logic, and rate limiting
- **API Controllers**: Complete REST API for payment operations
- **Artisan Commands**: Package management and installation

### **Developer Experience**

[](#developer-experience)

- **Comprehensive Testing**: Feature and unit tests with 100% coverage
- **Complete Documentation**: API docs, examples, and guides
- **Easy Installation**: One-command setup with `php artisan paygate:install`
- **Configuration Management**: Environment-based configuration
- **Error Handling**: Graceful error management and logging

🚀 Version 2.0.0 - What's New
----------------------------

[](#-version-200---whats-new)

### **Major Features**

[](#major-features)

- **7 Payment Gateways** - Paystack, GTPay, Flutterwave, Monnify, Interswitch, Remita, VTPass
- **JavaScript SDK** - Complete client-side payment handling
- **Plugin System** - Extensible architecture for custom features
- **Advanced Security** - Fraud detection, data encryption, audit logging
- **Performance Optimization** - Caching, rate limiting, retry logic
- **Complete Frontend** - Blade components, responsive design, real-time notifications

### **Migration from v1.x**

[](#migration-from-v1x)

- ✅ **Backward Compatible** - Old API still works
- ✅ **Easy Migration** - One-command migration
- ✅ **Enhanced Features** - All new features available
- 📖 **Migration Guide** - [Complete migration guide](docs/v2/migration-guide.md)

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
# Install v2.0.0
composer require obrainwave/paygate:^2.0

# Or update from v1.x
composer update obrainwave/paygate
```

### 2. Run the Installation Command

[](#2-run-the-installation-command)

```
php artisan paygate:install
```

This command will:

- Publish migrations and config files
- Run database migrations
- Add environment variables to your `.env` file

### 3. Configure Environment Variables

[](#3-configure-environment-variables)

Add your payment gateway credentials to your `.env` file:

```
# Paystack Configuration
PAYSTACK_PUBLIC_KEY=your_paystack_public_key
PAYSTACK_SECRET_KEY=your_paystack_secret_key
PAYSTACK_WEBHOOK_SECRET=your_paystack_webhook_secret

# GTPay Configuration
GTPAY_PUBLIC_KEY=your_gtpay_public_key
GTPAY_SECRET_KEY=your_gtpay_secret_key
GTPAY_WEBHOOK_SECRET=your_gtpay_webhook_secret

# Flutterwave Configuration
FLUTTERWAVE_PUBLIC_KEY=your_flutterwave_public_key
FLUTTERWAVE_SECRET_KEY=your_flutterwave_secret_key
FLUTTERWAVE_WEBHOOK_SECRET=your_flutterwave_webhook_secret

# Monnify Configuration
MONNIFY_API_KEY=your_monnify_api_key
MONNIFY_SECRET_KEY=your_monnify_secret_key
MONNIFY_WEBHOOK_SECRET=your_monnify_webhook_secret

# Interswitch Configuration
INTERSWITCH_CLIENT_ID=your_interswitch_client_id
INTERSWITCH_CLIENT_SECRET=your_interswitch_client_secret
INTERSWITCH_WEBHOOK_SECRET=your_interswitch_webhook_secret

# Remita Configuration
REMITA_MERCHANT_ID=your_remita_merchant_id
REMITA_API_KEY=your_remita_api_key
REMITA_SERVICE_TYPE_ID=your_remita_service_type_id
REMITA_WEBHOOK_SECRET=your_remita_webhook_secret

# VTPass Configuration
VTPASS_API_KEY=your_vtpass_api_key
VTPASS_SECRET_KEY=your_vtpass_secret_key
VTPASS_WEBHOOK_SECRET=your_vtpass_webhook_secret

# Security & Performance
PAYGATE_ENCRYPT_SENSITIVE_DATA=true
PAYGATE_MASK_SENSITIVE_LOGS=true
PAYGATE_ENABLE_CACHING=true
PAYGATE_CACHE_TTL=300
PAYGATE_FRAUD_DETECTION=true
PAYGATE_RISK_THRESHOLD=6
```

### 4. Clear Configuration Cache

[](#4-clear-configuration-cache)

```
php artisan config:cache
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

#### 1. Using the Facade (Recommended)

[](#1-using-the-facade-recommended)

```
use Paygate;

// Initiate Payment
$payment = Paygate::initiatePayment([
    'provider' => 'paystack',
    'amount' => 250,
    'email' => 'customer@example.com',
    'reference' => 'TXN_' . time(),
    'redirect_url' => 'https://yoursite.com/payment/callback',
    'name' => 'John Doe',
    'phone_number' => '08012345678'
]);

// Verify Payment
$verification = Paygate::verifyPayment([
    'provider' => 'paystack',
    'reference' => 'TXN_1234567890'
]);

// Refund Payment
$refund = Paygate::refundPayment([
    'provider' => 'paystack',
    'reference' => 'TXN_1234567890',
    'amount' => 100, // Optional: partial refund
    'reason' => 'Customer requested refund'
]);
```

#### 2. Using Dependency Injection

[](#2-using-dependency-injection)

```
use Obrainwave\Paygate\Contracts\PaymentServiceInterface;

class PaymentController extends Controller
{
    public function __construct(
        protected PaymentServiceInterface $paymentService
    ) {}

    public function initiate(Request $request)
    {
        $result = $this->paymentService->initiatePayment($request->all());
        return response()->json($result);
    }
}
```

#### 3. Using Web Routes

[](#3-using-web-routes)

```
// POST /paygate/initiate
Route::post('/paygate/initiate', function(Request $request) {
    return Paygate::initiatePayment($request->all());
});

// GET /paygate/verify/{reference}
Route::get('/paygate/verify/{reference}', function($reference) {
    return Paygate::verifyPayment(['reference' => $reference]);
});
```

#### 4. Using API Routes

[](#4-using-api-routes)

```
// POST /api/paygate/initiate
// GET /api/paygate/verify/{reference}
// POST /api/paygate/refund
// GET /api/paygate/status/{reference}
// GET /api/paygate/history
// GET /api/paygate/gateways
```

### Advanced Features

[](#advanced-features-1)

#### Database Integration

[](#database-integration)

```
// Get payment by reference
$payment = Paygate::getPaymentByReference('TXN_1234567890');

// Get payment history with filters
$history = Paygate::getPaymentHistory([
    'status' => 'successful',
    'provider' => 'paystack',
    'customer_email' => 'customer@example.com',
    'date_from' => '2024-01-01',
    'date_to' => '2024-12-31'
]);

// Get available gateways
$gateways = Paygate::getAvailableGateways();
```

#### Laravel Events

[](#laravel-events)

```
// Listen to payment events
use Obrainwave\Paygate\Events\PaymentInitiated;
use Obrainwave\Paygate\Events\PaymentCompleted;
use Obrainwave\Paygate\Events\PaymentFailed;

Event::listen(PaymentCompleted::class, function($payment) {
    // Send confirmation email
    Mail::to($payment->customer_email)->send(new PaymentConfirmation($payment));
});

Event::listen(PaymentFailed::class, function($payment) {
    // Log failed payment
    Log::error('Payment failed', (array) $payment);
});
```

#### Blade Components

[](#blade-components)

```

@include('paygate::components.payment-form')
```

### Legacy Usage (Backward Compatibility)

[](#legacy-usage-backward-compatibility)

The package maintains backward compatibility with the original API:

```
use Paygate;

$payload = [
    'provider' => 'paystack',
    'provider_token' => 'PAYSTACK_SECRET_KEY', // Still supported
    'amount' => 250,
    'email' => 'customer@example.com',
    'reference' => 'TXN_1234567890',
    'redirect_url' => 'https://yoursite.com/verify-payment',
    'name' => 'John Doe',
    'contract_code' => '32904826734', // For Monnify
    'payment_methods' => ["card", "bank", "ussd", "qr", "mobile_money", "bank_transfer", "eft"],
    'pass_charge' => false, // For GTPay
    'title' => "Your Store Name", // For Flutterwave
    'logo' => 'https://yoursite.com/logo.png', // For Flutterwave
    'phone_number' => '08012345678' // For Flutterwave
];

$payment = Paygate::initiatePayment($payload);
```

🎯 **Advanced Features**
-----------------------

[](#-advanced-features)

### **Database Integration**

[](#database-integration-1)

The package automatically stores payment records in the database:

```
// Get payment by reference
$payment = Paygate::getPaymentByReference('TXN_1234567890');

// Get payment history with filters
$history = Paygate::getPaymentHistory([
    'status' => 'successful',
    'provider' => 'paystack',
    'customer_email' => 'customer@example.com',
    'date_from' => '2024-01-01',
    'date_to' => '2024-12-31'
]);

// Use Eloquent model directly
use Obrainwave\Paygate\Models\Payment;

$payments = Payment::successful()
    ->byProvider('paystack')
    ->where('amount', '>', 100)
    ->orderBy('created_at', 'desc')
    ->get();
```

### **Laravel Events**

[](#laravel-events-1)

Listen to payment lifecycle events:

```
use Obrainwave\Paygate\Events\PaymentInitiated;
use Obrainwave\Paygate\Events\PaymentCompleted;
use Obrainwave\Paygate\Events\PaymentFailed;

// In your EventServiceProvider
protected $listen = [
    PaymentCompleted::class => [
        SendPaymentConfirmationEmail::class,
        UpdateOrderStatus::class,
    ],
    PaymentFailed::class => [
        LogFailedPayment::class,
        SendFailureNotification::class,
    ],
];

// Or use Event::listen
Event::listen(PaymentCompleted::class, function($payment) {
    // Send confirmation email
    Mail::to($payment->customer_email)->send(new PaymentConfirmation($payment));

    // Update order status
    Order::where('payment_reference', $payment->reference)
         ->update(['status' => 'paid']);
});
```

### **Webhook Handling**

[](#webhook-handling)

The package includes comprehensive webhook handling:

```
// Webhook endpoint is automatically available at:
// POST /paygate/webhook
// POST /api/paygate/webhook

// Configure webhook secrets in your .env:
PAYSTACK_WEBHOOK_SECRET=your_webhook_secret
GTPAY_WEBHOOK_SECRET=your_webhook_secret
FLUTTERWAVE_WEBHOOK_SECRET=your_webhook_secret
MONNIFY_WEBHOOK_SECRET=your_webhook_secret
```

### **Middleware Protection**

[](#middleware-protection)

Protect routes that require successful payments:

```
// In your routes file
Route::group(['middleware' => [VerifyPaymentMiddleware::class]], function () {
    Route::get('/download/{reference}', [DownloadController::class, 'download']);
    Route::get('/access/{reference}', [AccessController::class, 'grant']);
});

// The middleware automatically:
// - Verifies payment exists
// - Checks payment status is 'successful'
// - Adds payment data to request
```

### **API Endpoints**

[](#api-endpoints)

Complete REST API for payment operations:

```
// Payment Operations
POST   /api/paygate/initiate     # Initiate payment
GET    /api/paygate/verify/{ref} # Verify payment
POST   /api/paygate/refund      # Refund payment
GET    /api/paygate/status/{ref}# Get payment status
GET    /api/paygate/history     # Get payment history
GET    /api/paygate/gateways    # Get available gateways
POST   /api/paygate/webhook     # Webhook endpoint

// Web Routes
POST   /paygate/initiate        # Initiate payment
GET    /paygate/verify/{ref}    # Verify payment
GET    /paygate/callback        # Payment callback
GET    /paygate/status/{ref}    # Payment status
GET    /paygate/history         # Payment history
GET    /paygate/success/{ref}   # Success page (protected)
```

### **JavaScript SDK**

[](#javascript-sdk)

The package includes a comprehensive JavaScript SDK for client-side payment handling:

```

const paygate = new Paygate({
    baseUrl: '/api/paygate',
    defaultProvider: 'paystack',
    defaultCurrency: 'NGN',
    onSuccess: function(response) {
        console.log('Payment successful:', response);
        // Handle success
    },
    onError: function(response) {
        console.error('Payment failed:', response);
        // Handle error
    }
});

// Initiate payment
paygate.initiatePayment({
    provider: 'paystack',
    amount: 250.00,
    email: 'customer@example.com',
    reference: 'TXN_1234567890'
});

```

### **Auto-Initialization**

[](#auto-initialization)

The SDK automatically initializes payment forms with data attributes:

```

    Pay Now

```

### **Blade Components**

[](#blade-components-1)

Use pre-built components in your views:

```

@include('paygate::components.payment-form')

@if($payment->status === 'successful')

        Payment successful! Reference: {{ $payment->reference }}

@endif
```

### **Testing**

[](#testing)

The package includes comprehensive tests:

```
# Run tests
php artisan test

# Run specific test suites
php artisan test --filter=PaymentTest
php artisan test --filter=PaymentServiceTest

# Test coverage
php artisan test --coverage
```

### **Configuration Options**

[](#configuration-options)

Customize the package behavior:

```
// config/paygate.php
return [
    'default_currency' => 'NGN',
    'default_provider' => 'paystack',
    'enable_logging' => true,
    'store_payments' => true,
    'webhook_enabled' => true,
    'rate_limit' => 60,
    'retry_attempts' => 3,
    'encrypt_sensitive_data' => true,
    // ... more options
];
```

### **Environment Variables**

[](#environment-variables)

Configure your payment gateways:

```
# Package Settings
PAYGATE_DEFAULT_CURRENCY=NGN
PAYGATE_DEFAULT_PROVIDER=paystack
PAYGATE_ENABLE_LOGGING=true
PAYGATE_STORE_PAYMENTS=true

# Paystack
PAYSTACK_PUBLIC_KEY=pk_test_...
PAYSTACK_SECRET_KEY=sk_test_...
PAYSTACK_WEBHOOK_SECRET=whsec_...

# GTPay
GTPAY_PUBLIC_KEY=pk_...
GTPAY_SECRET_KEY=sk_...
GTPAY_WEBHOOK_SECRET=...

# Flutterwave
FLUTTERWAVE_PUBLIC_KEY=FLWPUBK_...
FLUTTERWAVE_SECRET_KEY=FLWSECK_...
FLUTTERWAVE_WEBHOOK_SECRET=...

# Monnify
MONNIFY_API_KEY=MK_...
MONNIFY_SECRET_KEY=...
MONNIFY_WEBHOOK_SECRET=...
```

🔧 **Artisan Commands**
----------------------

[](#-artisan-commands)

Manage the package with built-in commands:

```
# Install the package
php artisan paygate:install

# Publish migrations only
php artisan vendor:publish --tag=paygate-migrations

# Publish config only
php artisan vendor:publish --tag=paygate-config

# Clear payment cache
php artisan cache:clear
```

🛡️ **Security Features**
------------------------

[](#️-security-features)

- **Webhook Signature Verification**: All webhooks are verified using HMAC signatures
- **Middleware Protection**: Routes can be protected to require successful payments
- **Data Encryption**: Sensitive payment data can be encrypted
- **Rate Limiting**: Built-in rate limiting for payment endpoints
- **Input Validation**: Comprehensive validation for all payment data
- **Audit Logging**: Complete audit trail of all payment operations

📊 **Monitoring &amp; Analytics**
--------------------------------

[](#-monitoring--analytics)

```
// Get payment statistics
$stats = [
    'total_payments' => Payment::count(),
    'successful_payments' => Payment::successful()->count(),
    'failed_payments' => Payment::failed()->count(),
    'total_amount' => Payment::successful()->sum('amount'),
    'average_amount' => Payment::successful()->avg('amount'),
];

// Get provider performance
$providerStats = Payment::selectRaw('provider, COUNT(*) as count, SUM(amount) as total')
    ->groupBy('provider')
    ->get();
```

🚀 **Performance Optimization**
------------------------------

[](#-performance-optimization)

- **Caching**: Response caching for better performance
- **Database Indexing**: Optimized database queries
- **Lazy Loading**: Efficient data loading
- **Connection Pooling**: Reuse HTTP connections
- **Async Processing**: Background job processing for webhooks

🔄 **Migration Guide**
---------------------

[](#-migration-guide)

If you're upgrading from an older version:

1. **Backup your data** before upgrading
2. **Run the installation command**: `php artisan paygate:install`
3. **Update your environment variables** with new configuration options
4. **Test your payment flows** to ensure everything works correctly
5. **Update your code** to use new features (optional)

🤝 **Contributing**
------------------

[](#-contributing)

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

📄 **License**
-------------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

🆘 **Support**
-------------

[](#-support)

- **Documentation**: [Full Documentation](https://github.com/obrainwave/paygate)
- **Issues**: [GitHub Issues](https://github.com/obrainwave/paygate/issues)
- **Discussions**: [GitHub Discussions](https://github.com/obrainwave/paygate/discussions)

#### Request Fields

[](#request-fields)

The table below shows and explains the field features.
Note the **Mandatory(M)**, **Optional(O)**, and **Not Applicable(N/A)** used in the table.

Field NameTypePaystackGTPayFlutterwaveMonnifyDescription`provider`stringMMMMThis is the payment gateway name.
 For now can only be **paystack**, **gtpay**, **flutterwave** and **monnify**.`provider_token`stringMMMMThis is the payment gateway `access_token` or `API Secret Key`.
 For **Monnify** only, your `API Key` and `Secret Key` should be in `ApiKey:SecretKey` format as `provider_token``amount`floatMMMMThis is the amount to be charged for the transaction or the amount you are debiting customer.`email`stringMMMMCustomer's email address`reference`stringMMMMYour unique generated reference`redirect_url`urlOOOOFully qualified url, e.g.  .
Use this to override the callback url provided on the dashboard for this transaction`name`stringOOOMCustomer's name`contract_code`stringN/AN/AN/AMCustomer's email address`payment_methods`arrayOOOOAn array of payment methods or channels to control what channels you want to make available to the user to make a payment with.
E.g available channels for `paystack` include: \["card", "bank", "ussd", "qr", "mobile\_money", "bank\_transfer", "left"\].
Check other payment gateways documentation for their available payment methods or channels.`pass_charge`booleanN/AON/AN/AThis is only applicable to **gtpay**.
 It takes two possible values: True or False.
It is set to False by default. When set to True, the charges on the transaction is computed and passed on to the customer(payer).
But when set to False, the charge is passed to the merchant and will be deducted from the amount to be settled to the merchant.`logo`urlN/AN/AON/AThis is only applicable to **flutterwave**.
The Merchant's logo URL.`title`urlN/AN/AON/AThis is only applicable to **flutterwave**.
The name to display on the checkout page.`phone_number`stringN/AN/AON/AThis is only applicable to **flutterwave**.
This is the phone number linked to the customer's bank account or mobile money account#### Response Sample

[](#response-sample)

If successful, you will receive a response that looks like the below sample response

```
{
  "errors": false
  "message": "Payment initiated successfully with paystack"
  "data": {
    "checkout_url": "https://checkout.paystack.com/gfe327lipw13uit"
    "reference": "T2CZ143DUMG"
    "access_code": "gfe327lipw13uit"
    "provider": "paystack"
  }
}
```

#### Response Fields

[](#response-fields)

Note that the table below shows and explains the most important fields to complete the payment or transaction.

Field NameTypeDescription`errors`booleanCan only be **true** or **false**. The request was successful if **true** and **false** if the request was not successful`message`stringShort description of the request`data`objectThis contains all the parameters you need to complete the payment or transaction`data->checkout_url`urlThis is the checkout url from the payment gateway for the customer to complete the payment. You can redirect this url to give customer interface.`data->reference`stringMerchant's Unique reference for the transaction. The unique generated reference you send via request to payment gateway.`data->access_code`stringUnique reference generated for the transaction by payment gateway.`provider`stringThis is the payment gateway name.
 For now can only be **paystack**, **gtpay**, **flutterwave** and **monnify**.### Verify Payment/Transaction

[](#verify-paymenttransaction)

You can load Paygate instance using **`use \Obrainwave\Paygate\Facades\Paygate`** or just use the facade **`use Paygate`**.

#### Request Sample

[](#request-sample)

```
use Paygate;

$payload = array(
  'provider' => 'gtpay',
  'provider_token' => 'GTPAY_SECRET_KEY', // Make sure you don't expose this in your code
  'reference' => 'T2CZ143DUMG',

 );

$payment = Paygate::verifyPayment($payload);
```

#### Request Fields

[](#request-fields-1)

The table below shows and explains the field features.
Note the **Mandatory(M)**, **Optional(O)**, and **Not Applicable(N/A)** used in the table.

Field NameTypePaystackGTPayFlutterwaveMonnifyDescription`provider`stringMMMMThis is the payment gateway name.
 For now can only be **paystack**, **gtpay**, **flutterwave** and **monnify**.`provider_token`stringMMMMThis is the payment gateway `access_token` or `API Secret Key`.
 For **Monnify** only, you your `API Key` and `Secret Key` should be in `ApiKey:SecretKey` format as `provider_token``reference`stringMMMMYour unique generated reference sent to payment gateway. It should also be returned via payment initiation response#### Response Sample

[](#response-sample-1)

If successful, you will receive a response that looks like the below sample response

```
{
  "errors": false
  "message": "Payment fetched successfully with gtpay"
  "provider": "gtpay"
  "status": "successful"
  "amount": 230
  "charged_amount": 232.3
  "reference": "9412041935"
  "provider_reference": "8359610303031725065306645",
  "payment_method": "card"
  "data": {
    ...
  }
}
```

#### Response Fields

[](#response-fields-1)

Note that the table below shows and explains the most important fields that decide the payment or transaction status.

Field NameTypeDescription`errors`booleanCan only be **true** or **false**. The request was successful if **true** and **false** if the request was not successful`message`stringShort description of the request`provider`stringThis is the payment gateway name.
 For now can only be **paystack**, **gtpay**, **flutterwave** and **monnify**.`status`stringCan only be **successful** or **failed**. The payment was completed and successful if **successful** and **failed** if the payment was not successful or not completed.
 If you want to dig more about the `status`, check for payment gateway transaction status in `data` field.
 `status` for **paystack**, `transaction_status` for **gtpay**, `status` for **flutterwave**, and `paymentStatus` for **monnify**.`amount`floatAmount initiated to be paid by the customer from your transaction`charged_amount`floatTotal amount charged by payment gateway and paid by the customer. This can be equal to the `amount` if you don't pass the charge to your customer.`reference`stringYour unique generated reference sent to the payment gateway. It should also be returned via payment verification response`provider_reference`stringUnique reference generated for the transaction by the payment gateway. It should also be returned via payment verification response`data`objectThis contains all the parameters you need to play with the payment or transaction verificationConclusion
----------

[](#conclusion)

Presently only local payment gateways work. International payment gateways(such as Stripe, Paypal, etc) will be added.
For this package only initiates and verifies transactions at minimum version. More features will be added in subsequent versions. **Please watchout!!!**

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

🔧 **Advanced Features**
-----------------------

[](#-advanced-features-1)

### **Caching System**

[](#caching-system)

The package includes a comprehensive caching system for improved performance:

```
// Enable caching in config
'enable_caching' => true,
'cache_ttl' => 300, // 5 minutes

// Cache is automatically handled, but you can manage it manually
$cacheService = app(CacheService::class);

// Clear payment cache
$cacheService->clearPaymentCache('payment_initiate_paystack_' . $reference);

// Clear all caches
$cacheService->clearAllPaymentCaches();
```

### **Security Suite**

[](#security-suite)

Advanced security features to protect payment data:

```
// Data encryption (automatic)
'encrypt_sensitive_data' => true,

// Log masking (automatic)
'mask_sensitive_logs' => true,

// Fraud detection
$fraudService = app(FraudDetectionService::class);
$riskAnalysis = $fraudService->analyzePayment($paymentData);

if ($riskAnalysis['recommendation'] === 'decline') {
    // Handle high-risk payment
}
```

### **Plugin System**

[](#plugin-system)

Extensible architecture for custom features:

```
// Create a custom plugin
class CustomNotificationPlugin implements PluginInterface
{
    public function getName(): string
    {
        return 'CustomNotificationPlugin';
    }

    public function registerHooks(): array
    {
        return ['payment.completed'];
    }

    public function handleHook(string $hook, array $data = []): mixed
    {
        // Custom logic here
        return null;
    }
}

// Register the plugin
$pluginManager = app(PluginManager::class);
$pluginManager->registerPlugin(new CustomNotificationPlugin());
```

### **Performance Optimization**

[](#performance-optimization)

Built-in performance features:

```
// Rate limiting
'rate_limit' => 60, // requests per minute

// Retry logic
'retry_attempts' => 3,
'retry_delay' => 1000, // milliseconds

// Response caching
'cache_ttl' => 300, // 5 minutes
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Olaiwola Akeem Salau](https://github.com/Obrainwave)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance63

Regular maintenance activity

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~36 days

Recently: every ~0 days

Total

13

Last Release

226d ago

Major Versions

v1.0.4 → v2.0.02025-10-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40363034?v=4)[Olaiwola Akeem](/maintainers/obrainwave)[@Obrainwave](https://github.com/Obrainwave)

---

Top Contributors

[![Obrainwave](https://avatars.githubusercontent.com/u/40363034?v=4)](https://github.com/Obrainwave "Obrainwave (34 commits)")

---

Tags

deploymentdocumentationinstallationlaravel-packagelaravelsecuritypaymentgatewayfraud detectionpaystackflutterwaveplugin-systemmonnifyobrainwavepaygateInterswitchVtpassremitajavascript-sdk

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/obrainwave-paygate/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

8118.0k](/packages/danestves-laravel-polar)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

882.2k1](/packages/musahmusah-laravel-multipayment-gateways)[mradder/filament-logger

Audit logging, activity tracking, exports, alerts, and dashboards for Filament admin panels.

2310.5k](/packages/mradder-filament-logger)

PHPackages © 2026

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