PHPackages                             royalbcode/laravel-alatpay - 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. royalbcode/laravel-alatpay

ActiveLibrary[Payment Processing](/categories/payments)

royalbcode/laravel-alatpay
==========================

An independent, open-source Laravel SDK for integrating ALATPay (by Wema Bank) payment services: bank transfer, USSD, account-number debit and static wallets.

v1.0.0(3d ago)00MITPHP ^8.1

Since Jul 5Compare

[ Source](https://github.com/Royal-Bcode-Ventures/laravel-alatpay)[ Packagist](https://packagist.org/packages/royalbcode/laravel-alatpay)[ Docs](https://github.com/Royal-Bcode-Ventures/laravel-alatpay)[ RSS](/packages/royalbcode-laravel-alatpay/feed)WikiDiscussions Synced today

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

Laravel ALATPay SDK
===================

[](#laravel-alatpay-sdk)

[![Latest Version](https://camo.githubusercontent.com/4f7e0d0b2eb3de8c977c19f21c7250bee9dcbaef07d742736035565ed3a1f2e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c7565)](https://github.com/Royal-Bcode-Ventures/laravel-alatpay)[![Tests](https://github.com/Royal-Bcode-Ventures/laravel-alatpay/actions/workflows/tests.yml/badge.svg)](https://github.com/Royal-Bcode-Ventures/laravel-alatpay/actions/workflows/tests.yml)[![License: MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/a3d40f0d75d713ca57f5c82ae476ae92aed55e0868a2d6284c4634aa0f270650/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d373737626234)](composer.json)

An independent, open-source Laravel SDK for integrating **ALATPay** (a payment product by Wema Bank) into your Laravel application with virtual account bank transfers, USSD (Pay-with-Phone), Pay-with-Account-Number direct debit, and Static Wallets.

> **Disclaimer:** This package is an independent, community-built SDK. It is **not affiliated with, endorsed by, or maintained by Wema Bank PLC or ALATPay**. It simply wraps their publicly documented HTTP API for convenient use inside Laravel applications.

---

Features
--------

[](#features)

- 🏦 **Bank Transfer** — generate one-time virtual accounts and confirm transaction status
- 📱 **USSD (Pay with Phone)** — initiate and complete phone-based direct debits
- 💳 **Pay with Account Number** — OTP-based direct debit from a Wema Bank account
- 🗂 **Static Wallets** — create and manage Individual &amp; Collection wallets, list accounts, and pull collection history
- 📊 **Transaction Monitoring** — list/filter every transaction across all payment channels, or fetch one by ID
- 💰 **Settlements** — retrieve and filter settlement/payout records for your business
- ⚡️ Laravel auto-discovery, Facade, and a clean, chainable service API
- 🧰 Built on Laravel's native `Http` client — no extra HTTP dependencies
- ✅ Typed exceptions (`AlatPayException`) with status code, raw API context, and helper methods matching ALATPay's documented error codes
- 🧪 Fully tested with Pest + Orchestra Testbench

---

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

[](#installation)

Install via Composer:

```
composer require royalbcode/laravel-alatpay
```

The package auto-registers its service provider and `AlatPay` facade. Publish the config file:

```
php artisan vendor:publish --tag=alatpay-config
```

Add your credentials to `.env`:

```
ALATPAY_SECRET_KEY=your-secret-key
ALATPAY_PUBLIC_KEY=your-public-key
ALATPAY_BUSINESS_ID=your-business-id
ALATPAY_BASE_URL=https://apibox.alatpay.ng
ALATPAY_TIMEOUT=30
```

You can find your keys and Business ID on your ALATPay dashboard under **Settings → Business** (requires your ALATPay PIN).

---

Usage
-----

[](#usage)

You can resolve the client via the `AlatPay` facade, dependency injection, or the `alatpay` container binding.

### 1. Bank Transfer (Virtual Account)

[](#1-bank-transfer-virtual-account)

```
use RoyalBcode\AlatPay\Facades\AlatPay;

// Step 1: generate a virtual account for the customer to pay into
$virtualAccount = AlatPay::bankTransfer()->generateVirtualAccount([
    'amount' => 5000,
    'orderId' => 'ORDER-001',
    'description' => 'Order payment',
    'customer' => [
        'email' => 'johndoe@email.com',
        'phone' => '08000000001',
        'firstName' => 'John',
        'lastName' => 'Doe',
    ],
]);

$transactionId = $virtualAccount['data']['transactionId'];
$accountNumber = $virtualAccount['data']['virtualBankAccountNumber'];

// Step 2: poll/confirm the transaction status
$status = AlatPay::bankTransfer()->confirmTransaction($transactionId);
```

### 2. USSD (Pay with Phone)

[](#2-ussd-pay-with-phone)

```
// Step 1: initiate
$initiated = AlatPay::ussd()->initiate([
    'amount' => 250,
    'customer' => [
        'email' => 'example@example.com',
        'phone' => '1234567890',
        'firstName' => 'John',
        'lastName' => 'Doe',
    ],
    'phonenumber' => '0987654321',
]);

$transactionId = $initiated['data']['transactionId'];

// Step 2: customer approves the prompt on their phone, then validate
$result = AlatPay::ussd()->validateAndPay([
    'phonenumber' => '0987654321',
    'amount' => 250,
    'transactionId' => $transactionId,
]);
```

### 3. Pay with Account Number

[](#3-pay-with-account-number)

```
// Step 1: send an OTP to the account owner's registered phone number
$otp = AlatPay::accountNumber()->sendOtp([
    'amount' => 1000,
    'customer' => [
        'email' => 'jane.joe@email.com',
        'phone' => '+2348000000001',
        'firstName' => 'Jane',
        'lastName' => 'Joe',
    ],
    'accountNumber' => '0123456789',
    // 'bankCode' => '035', // defaults to Wema Bank's code automatically
]);

$transactionId = $otp['data']['transactionId'];

// Step 2: validate the OTP entered by the customer
$result = AlatPay::accountNumber()->validateAndPay([
    'otp' => '332610',
    'transactionId' => $transactionId,
]);
```

### 4. Static Wallets

[](#4-static-wallets)

```
use RoyalBcode\AlatPay\Services\StaticWalletService;

// Create an individual wallet (BVN-linked)
$wallet = AlatPay::staticWallet()->create([
    'staticWalletType' => StaticWalletService::WALLET_TYPE_INDIVIDUAL,
    'bvn' => '12345678901',
    'email' => 'owner@example.com', // optional
]);

// Validate the OTP sent to the BVN-linked phone number
$created = AlatPay::staticWallet()->validateAndCreate([
    'staticWalletId' => $wallet['id'],
    'otp' => '332610',
    'trackingId' => $wallet['otpTrackingID'],
]);

// List all static wallets for the business
$wallets = AlatPay::staticWallet()->list(['page' => 1, 'limit' => 10]);

// Pull collection/transaction history
$history = AlatPay::staticWallet()->history(['page' => 1, 'limit' => 10]);

// Get details for one wallet
$details = AlatPay::staticWallet()->details($wallet['id']);
```

### 5. Transaction Monitoring

[](#5-transaction-monitoring)

```
// List/filter all transactions across every payment channel
$transactions = AlatPay::transactions()->all([
    'page' => 1,
    'limit' => 20,
    'status' => 'completed',       // optional
    'paymentMethod' => 'BankTransfer', // optional
    'amount' => 5000,              // optional
    'startAt' => '2026-01-01',     // optional
    'endAt' => '2026-01-31',       // optional
]);

// Fetch a single transaction by its ID
$transaction = AlatPay::transactions()->find('transaction-id');
```

### 6. Settlements

[](#6-settlements)

```
// List/filter settlement (payout) records for your business
$settlements = AlatPay::settlements()->all([
    'status' => 'settled',      // optional
    'startAt' => '2026-01-01',  // optional
    'endAt' => '2026-01-31',    // optional
]);
```

---

Error Handling
--------------

[](#error-handling)

Every service method throws `RoyalBcode\AlatPay\Exceptions\AlatPayException` when ALATPay returns a failure response (non-2xx status, or `"status": false` in the payload):

```
use RoyalBcode\AlatPay\Exceptions\AlatPayException;

try {
    AlatPay::bankTransfer()->generateVirtualAccount([...]);
} catch (AlatPayException $e) {
    $e->getMessage();      // ALATPay's error message
    $e->getStatusCode();   // HTTP status code returned
    $e->getContext();      // Full decoded JSON response body

    // Convenience checks matching ALATPay's documented response codes
    $e->isBadRequest();                     // 400 - missing/invalid parameters
    $e->isUnauthorized();                   // 401 - invalid Ocp-Apim-Subscription-Key
    $e->isVirtualAccountGenerationFailed();  // 417 - contact ALATPay support
    $e->isValidationError();                // 422 - a required field is missing
    $e->isServerError();                    // 5xx - something went wrong on ALATPay's end
}
```

ALATPay's documented response codes:

CodeStatusMeaningWhat to do200 / 201SuccessRequest succeeded—400Bad RequestInvalid requestCheck required parameters and JSON validity401UnauthorizedInvalid subscription keyVerify `ALATPAY_SECRET_KEY`417Expectation FailedVirtual account generation failedContact ALATPay support422Unprocessable EntityA required field is missingCheck `$e->getMessage()` for the missing field5xxServer ErrorSomething went wrong on ALATPay's endRetry later---

Using Without the Facade
------------------------

[](#using-without-the-facade)

Resolve the client from the container if you prefer constructor injection:

```
use RoyalBcode\AlatPay\AlatPay;

class CheckoutController
{
    public function __construct(private AlatPay $alatPay) {}

    public function store()
    {
        return $this->alatPay->bankTransfer()->generateVirtualAccount([...]);
    }
}
```

---

Testing
-------

[](#testing)

```
composer install
vendor/bin/pest
```

All HTTP calls in the test suite are mocked with Laravel's `Http::fake()` — no live ALATPay credentials are required to run the tests.

---

Roadmap
-------

[](#roadmap)

- Transaction monitoring (list, filter, single lookup)
- Settlement records (list, filter)
- Card payment channel
- Webhook signature verification helper
- Artisan command for quick credential/connectivity checks

---

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

[](#contributing)

Issues and pull requests are welcome at the [GitHub repository](https://github.com/Royal-Bcode-Ventures/laravel-alatpay).

Security
--------

[](#security)

If you discover a security issue, please email the maintainers directly rather than opening a public issue.

License
-------

[](#license)

Released under the [MIT License](LICENSE.md).

---

Credits
-------

[](#credits)

Developed and maintained by **Royal Bcode Ventures Ltd**Lead Developer: **Gift Balogun** — [giftbalogun.name.ng](https://giftbalogun.name.ng)GitHub: [github.com/Royal-Bcode-Ventures](https://github.com/giftbalogun)

This is an independent open-source project built for developer education and portfolio purposes. It is not affiliated with, endorsed by, or sponsored by Wema Bank PLC or ALATPay.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance99

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fd5e8208752c78aca6ca611148207db293a2db4ed2cbb661ea8182949a4d60a?d=identicon)[amdeone](/maintainers/amdeone)

---

Tags

laravelNigeriapayment gatewayussdbank transferalatpaywema bankstatic wallet

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/royalbcode-laravel-alatpay/health.svg)

```
[![Health](https://phpackages.com/badges/royalbcode-laravel-alatpay/health.svg)](https://phpackages.com/packages/royalbcode-laravel-alatpay)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58173.9k16](/packages/api-platform-laravel)

PHPackages © 2026

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