hopekelldev/laravel-paystack

Modern Paystack SDK for Laravel 13 and PHP 8.3+.

Maintainers

Package info

github.com/HopekellDev/laravel-paystack

pkg:composer/hopekelldev/laravel-paystack

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-28 07:42 UTC

This package is auto-updated.

Last update: 2026-04-28 09:26:14 UTC


README

Packagist Version PHP Version Laravel Version License Downloads

Scrutinizer Code Quality

๐Ÿš€ Introduction

HopekellDev Laravel Paystack is a modern, lightweight, and fully customizable Paystack SDK built specifically for:

  • โšก Laravel 13+
  • ๐Ÿง  PHP 8.3+
  • ๐Ÿงฉ Clean architecture
  • ๐Ÿ”ฅ Static method access
  • ๐Ÿ›ก Simple exception handling
  • ๐Ÿ“ฆ Easy Laravel installation

Built for developers who want a modern Paystack integration without depending on outdated Laravel Paystack libraries.

โœจ Features

  • โœ… Laravel 13 support
  • โœ… PHP 8.3+ support
  • โœ… Static API style
  • โœ… Service-based structure
  • โœ… Centralized HTTP client
  • โœ… Standardized API responses
  • โœ… Built-in exception handling
  • โœ… Laravel package auto-discovery
  • โœ… Easy to extend with more Paystack endpoints

๐Ÿ“ฆ Installation

composer require hopekelldev/laravel-paystack

Publish the config file:

php artisan vendor:publish --tag=paystack-config

โš™๏ธ Configuration

Add your Paystack credentials to .env:

PAYSTACK_PUBLIC_KEY=pk_test_xxxxxx
PAYSTACK_SECRET_KEY=sk_test_xxxxxx
PAYSTACK_BASE_URL=https://api.paystack.co
PAYSTACK_TIMEOUT=30

๐Ÿงช Quick Usage

use HopekellDev\Paystack\Paystack;

$response = Paystack::transactions()->initialize([
    'email' => 'user@email.com',
    'amount' => 500000,
    'callback_url' => route('payment.callback'),
]);

return redirect($response['data']['authorization_url']);

๐Ÿ“˜ Basic Documentation

Transactions

Initialize Transaction

Paystack::transactions()->initialize([
    'email' => 'user@email.com',
    'amount' => 500000,
]);

Verify Transaction

Paystack::transactions()->verify($reference);

List Transactions

Paystack::transactions()->list([
    'perPage' => 50,
]);

Fetch Transaction

Paystack::transactions()->fetch($transactionId);

Plans

Create Plan

Paystack::plans()->create([
    'name' => 'Premium Plan',
    'amount' => 100000,
    'interval' => 'monthly',
]);

List Plans

Paystack::plans()->list();

Fetch Plan

Paystack::plans()->fetch($planCode);

Update Plan

Paystack::plans()->update($planCode, [
    'name' => 'Updated Premium Plan',
]);

Customers

Create Customer

Paystack::customers()->create([
    'email' => 'user@email.com',
    'first_name' => 'John',
    'last_name' => 'Doe',
]);

Fetch Customer

Paystack::customers()->fetch($emailOrCustomerCode);

Update Customer

Paystack::customers()->update($customerCode, [
    'first_name' => 'Updated Name',
]);

Dedicated Virtual Accounts

Create Dedicated Virtual Account

Paystack::dedicatedVirtualAccounts()->create([
    'customer' => $customerCode,
    'preferred_bank' => 'wema-bank',
]);

Assign Dedicated Virtual Account

Paystack::dedicatedVirtualAccounts()->assign([
    'email' => 'user@email.com',
    'first_name' => 'John',
    'last_name' => 'Doe',
    'phone' => '08000000000',
    'preferred_bank' => 'wema-bank',
    'country' => 'NG',
]);

List Dedicated Virtual Accounts

Paystack::dedicatedVirtualAccounts()->list();

Fetch Dedicated Virtual Account

Paystack::dedicatedVirtualAccounts()->fetch($dedicatedAccountId);

๐Ÿ“š Covered Endpoints

โœ… Transactions

  • Initialize Transaction
  • Verify Transaction
  • List Transactions
  • Fetch Transaction
  • Charge Authorization
  • Transaction Totals
  • Export Transactions

โœ… Plans

  • Create Plan
  • List Plans
  • Fetch Plan
  • Update Plan

โœ… Customers

  • Create Customer
  • List Customers
  • Fetch Customer
  • Update Customer
  • Validate Customer
  • Set Risk Action

โœ… Dedicated Virtual Accounts

  • Create Dedicated Account
  • Assign Dedicated Account
  • List Dedicated Accounts
  • Fetch Dedicated Account
  • Deactivate Dedicated Account
  • Split Dedicated Account
  • Remove Split
  • List Available Providers

โš ๏ธ Error Handling

All failed Paystack API requests throw:

HopekellDev\Paystack\Exceptions\PaystackException

Example:

use HopekellDev\Paystack\Exceptions\PaystackException;
use HopekellDev\Paystack\Paystack;

try {
    $response = Paystack::transactions()->verify($reference);
} catch (PaystackException $e) {
    return $e->getMessage();
}

๐Ÿงฑ Package Architecture

Paystack
โ”œโ”€โ”€ Services
โ”‚   โ”œโ”€โ”€ Transactions
โ”‚   โ”œโ”€โ”€ Plans
โ”‚   โ”œโ”€โ”€ Customers
โ”‚   โ””โ”€โ”€ DedicatedVirtualAccounts
โ”œโ”€โ”€ Helpers
โ”‚   โ”œโ”€โ”€ Http Client
โ”‚   โ””โ”€โ”€ Response Formatter
โ””โ”€โ”€ Exceptions

๐Ÿ—‚ Packaage Folder Structure

src/
โ”œโ”€โ”€ Paystack.php
โ”œโ”€โ”€ PaystackServiceProvider.php
โ”œโ”€โ”€ Exceptions/
โ”‚   โ””โ”€โ”€ PaystackException.php
โ”œโ”€โ”€ Helpers/
โ”‚   โ”œโ”€โ”€ ApiResponse.php
โ”‚   โ””โ”€โ”€ HasHttpClient.php
โ””โ”€โ”€ Services/
    โ”œโ”€โ”€ Transactions.php
    โ”œโ”€โ”€ Plans.php
    โ”œโ”€โ”€ Customers.php
    โ””โ”€โ”€ DedicatedVirtualAccounts.php

๐Ÿค Contributing

Contributions are welcome.

You can help by:

  • Adding more Paystack endpoints
  • Improving documentation
  • Writing tests
  • Improving error handling
  • Adding Laravel helpers
  • Improving developer experience

How to contribute

  1. Fork the repository
  2. Create a new branch
  3. Commit your changes
  4. Push to your branch
  5. Open a pull request

๐Ÿ”ฅ Roadmap

  • Subscriptions API
  • Transfers API
  • Transfer Recipients API
  • Settlements API
  • Refunds API
  • Disputes API
  • Webhook signature verification
  • Laravel webhook controller helper
  • Retry logic
  • Logging support
  • Pest test suite
  • GitHub Actions CI

๐Ÿ“ข Call for Collaboration

This library is actively open for collaboration and improvement.

If you are a Laravel developer, fintech builder, open-source contributor, or Paystack user, your support is welcome.

Help make this package better by submitting issues, pull requests, endpoint updates, and documentation improvements.

๐Ÿ›ก License

This package is open-sourced software licensed under the MIT License.

๐Ÿ‘จโ€๐Ÿ’ป Author

HopekellDev

Building scalable fintech, SaaS, and backend systems.

โญ Support

If this package helps you, please support it by:

  • Starring the repository
  • Sharing it with Laravel developers
  • Reporting bugs
  • Suggesting improvements
  • Contributing code

๐Ÿ“ฌ Contact

For support, collaboration, or questions:

Built for Laravel developers who need a clean, modern, and extendable Paystack SDK.