PHPackages                             chainbook/paystack - 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. chainbook/paystack

ActiveLibrary[Payment Processing](/categories/payments)

chainbook/paystack
==================

A Laravel package for seamless Paystack payment integration — initialize transactions, verify payments, manage customers, plans and subscriptions.

v1.0.0(2mo ago)043↑597.7%MITPHPPHP ^8.1

Since Mar 9Pushed 2mo agoCompare

[ Source](https://github.com/Chainbook-Software/laravel-paystack)[ Packagist](https://packagist.org/packages/chainbook/paystack)[ Docs](https://github.com/chainbook/paystack)[ RSS](/packages/chainbook-paystack/feed)WikiDiscussions main Synced 1mo ago

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

Chainbook Paystack
==================

[](#chainbook-paystack)

[![Latest Version on Packagist](https://camo.githubusercontent.com/83b7df8a80be33d9b7230e47d772d2d8fbd8b66d815d988523a752acffbb2b5a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636861696e626f6f6b2f706179737461636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chainbook/paystack)[![Total Downloads](https://camo.githubusercontent.com/32a214922f9b9029b4bcc7e106475aa0fa3b41c150ebb5ff42a18af0c7386dba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636861696e626f6f6b2f706179737461636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chainbook/paystack)[![License](https://camo.githubusercontent.com/295b191a1c998ac0a43d26914f350c4e87c02e33208607fdc7c64a4b1dbba53d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636861696e626f6f6b2f706179737461636b2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A clean, simple Laravel package for [Paystack](https://paystack.com) payment integration. Supports transactions, customers, plans, subscriptions and webhook verification — with zero configuration beyond your API keys.

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

[](#requirements)

- PHP **^8.1**
- Laravel **^10 | ^11 | ^12**

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

[](#installation)

```
composer require chainbook/paystack
```

Laravel's auto-discovery will register the service provider and `Paystack` facade automatically.

### Publish the config file (optional)

[](#publish-the-config-file-optional)

```
php artisan vendor:publish --provider="Chainbook\Paystack\PaystackServiceProvider" --tag="paystack-config"
```

### Add your keys to `.env`

[](#add-your-keys-to-env)

```
PAYSTACK_PUBLIC_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PAYSTACK_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

---

Usage
-----

[](#usage)

### Transactions

[](#transactions)

```
use Chainbook\Paystack\Facades\Paystack;

// Initialize a transaction
$response = Paystack::initializeTransaction([
    'email'        => 'customer@example.com',
    'amount'       => 500000, // Amount in kobo/pesewas (= 5000 NGN/GHS)
    'reference'    => uniqid('ref_'),
    'callback_url' => 'https://yourapp.com/payment/callback',
]);

// $response['data']['authorization_url'] — redirect the user here

// Verify a transaction
$verification = Paystack::verifyTransaction('ref_abc123');

if ($verification['data']['status'] === 'success') {
    // Payment confirmed
}

// List transactions
$transactions = Paystack::listTransactions(['perPage' => 20, 'page' => 1]);

// Fetch a specific transaction
$transaction = Paystack::fetchTransaction(123456789);

// Charge a returning customer using saved authorization
$charge = Paystack::chargeAuthorization([
    'authorization_code' => 'AUTH_xxxxxxxx',
    'email'              => 'customer@example.com',
    'amount'             => 500000,
]);
```

### Customers

[](#customers)

```
// Create a customer
$customer = Paystack::createCustomer([
    'email'      => 'customer@example.com',
    'first_name' => 'Jane',
    'last_name'  => 'Doe',
    'phone'      => '+2348012345678',
]);

// Fetch a customer (by ID or customer code)
$customer = Paystack::fetchCustomer('CUS_xxxxxxxx');

// Update a customer
Paystack::updateCustomer('CUS_xxxxxxxx', ['first_name' => 'Janet']);

// List customers
$customers = Paystack::listCustomers(['perPage' => 50]);
```

### Plans &amp; Subscriptions

[](#plans--subscriptions)

```
// Create a plan
$plan = Paystack::createPlan([
    'name'     => 'Monthly Premium',
    'interval' => 'monthly',
    'amount'   => 500000,
]);

// List plans / fetch / subscribe
$plans         = Paystack::listPlans();
$plan          = Paystack::fetchPlan('PLN_xxxxxxxx');
$subscription  = Paystack::createSubscription([
    'customer'   => 'CUS_xxxxxxxx',
    'plan'       => 'PLN_xxxxxxxx',
    'start_date' => now()->addDay()->toIso8601String(),
]);
$subscriptions = Paystack::listSubscriptions();
```

### Webhook Verification

[](#webhook-verification)

```
// routes/web.php
Route::post('/webhooks/paystack', function (Illuminate\Http\Request $request) {
    $signature = $request->header('X-Paystack-Signature');
    $computed  = hash_hmac('sha512', $request->getContent(), config('paystack.secret_key'));

    if ($signature !== $computed) {
        abort(400, 'Invalid signature');
    }

    $event = $request->json()->all();

    match ($event['event'] ?? null) {
        'charge.success'   => /* handle payment */ null,
        'transfer.success' => /* handle transfer */ null,
        default            => null,
    };

    return response('OK', 200);
})->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
```

### Get the Public Key (for frontend/JavaScript use)

[](#get-the-public-key-for-frontendjavascript-use)

```
$publicKey = Paystack::getPublicKey();
```

---

Configuration
-------------

[](#configuration)

After publishing, edit `config/paystack.php`:

```
return [
    'public_key'     => env('PAYSTACK_PUBLIC_KEY'),
    'secret_key'     => env('PAYSTACK_SECRET_KEY'),
    'base_url'       => env('PAYSTACK_BASE_URL', 'https://api.paystack.co'),
    'webhook_secret' => env('PAYSTACK_WEBHOOK_SECRET'),
];
```

---

Testing
-------

[](#testing)

```
composer test
```

---

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance88

Actively maintained with recent releases

Popularity11

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

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2346ad85cd04f55c8e50936240b92075da84271272df614113c20bedbe1e8682?d=identicon)[Chainbook-Software](/maintainers/Chainbook-Software)

---

Tags

laravelpaymentNigeriapaystackafricaSouth AfricaGhana

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chainbook-paystack/health.svg)

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

###  Alternatives

[evryn/laravel-toman

A simple stable Laravel package to handle popular payment gateways in Iran including ZarinPal and IDPay.

1079.9k](/packages/evryn-laravel-toman)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)[digikraaft/laravel-paystack-webhooks

Handle Paystack webhooks in a Laravel application

177.5k1](/packages/digikraaft-laravel-paystack-webhooks)

PHPackages © 2026

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