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

ActiveLibrary[Payment Processing](/categories/payments)

ayoolatj/paystack-php
=====================

Yet Another Paystack PHP Library

1.2.1(5y ago)211MITPHPPHP &gt;=7.1.0CI failing

Since Jul 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ayoolatj/paystack-php)[ Packagist](https://packagist.org/packages/ayoolatj/paystack-php)[ RSS](/packages/ayoolatj-paystack-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (7)Used By (0)

Yet another PHP API wrapper for [Paystack](https://paystack.co/).
=================================================================

[](#yet-another-php-api-wrapper-for-paystack)

[![Packagist](https://camo.githubusercontent.com/60fabcb766660aadeabeb86b6b6a73d9b109559dd6a5857b7060041335630da9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61796f6f6c61746a2f706179737461636b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ayoolatj/paystack-php)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This library aims to provide convenient access to the Paystack API using predefined services grouped following the [Paystack API Docs](https://paystack.com/docs/api/). These service classes initialize defined Resources dynamically from API responses.

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

[](#requirements)

- PHP 7.1+

Installing
----------

[](#installing)

### via Composer

[](#via-composer)

To install the package via [Composer](http://getcomposer.org/), run the following command:

```
composer require ayoolatj/paystack-php
```

Dependencies
------------

[](#dependencies)

- [Guzzle](https://github.com/guzzle/guzzle)

Dependencies should be handled automatically by composer.

Usage
-----

[](#usage)

Using the paystack instance, you can perform multiple actions across several services as well as retrieve different resources.

```
$paystack = new \Ayoolatj\Paystack\Paystack(PAYSTACK_SECRET_KEY);
try {
    $charge = $paystack->charge->charge([
        'email' => 'test@example.com',
        'amount' => '1000000',
        'bank' => ['code' => '057', 'account_number' => '0000000000'],
        'birthday' => '1994-07-04',
    ]);
} catch (\Ayoolatj\Paystack\Exceptions\ApiException $e) {
    print_r($e->getResponse());
}
// process Charge resource
```

### Accessing Resource Attributes

[](#accessing-resource-attributes)

You can access the resource attributes via `toArray()`.

```
$plan = $paystack->plans->create([
    'name' => 'New Plan',
    'amount' => '1000000',
    'interval' => 'biannually'
]);
print_r($plan->toArray());
```

### Accessing response data

[](#accessing-response-data)

You can access the data from the last API response on any resource object via `getLastResponse()`.

```
$charge = $paystack->charge->charge([
    'email' => 'test@example.com',
    'amount' => '1000000',
    'bank' => ['code' => '057', 'account_number' => '0000000000'],
    'birthday' => '1994-07-04',
]);
echo $charge->getLastResponse()->headers['Date'];
```

### Pagination

[](#pagination)

All services with a **list** endpoint support pagination and pagination parameters can be passed along to limit the result set.

```
$plans = $paystack->plans->all([
    'perPage' => 20,
    'page' => 2,
]);
```

#### Auto-Pagination

[](#auto-pagination)

List endpoints return an instance of a Paginator class which supports auto-pagination. This makes it easy to handle fetching multi page lists without having to manually paginate results and perform subsequent requests.

To use the auto-pagination feature, call `autoPagingIterator()` on the returned Paginator object to iterate over all objects matching your initial parameters.

```
$plans = $paystack->plans->all([
    'perPage' => 20,
    'page' => 2,
]);

foreach ($plans->autoPagingIterator() as $plan) {
  // Do something with $plan
}
```

### Webhooks

[](#webhooks)

Paystack uses webhooks to notify your application when transaction events occur on your integration. It is important to verify that events originate from Paystack to avoid delivering value based on a counterfeit event.

To verify a paystack event:

```
$input = @file_get_contents('php://input');
$paystack_signature = $_SERVER['HTTP_X_PAYSTACK_SIGNATURE'];

try {
    \Ayoolatj\Paystack\Webhook::verifyEvent($input, $paystack_signature, PAYSTACK_SECRET_KEY);
} catch (\Ayoolatj\Paystack\Exceptions\SignatureVerificationException $e) {
    $input = $e->getHttpBody();
    $header = $e->getSigHeader();

    exit();
}
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

TODOs
-----

[](#todos)

- Authorization Resource
- Roundup tests
- Metadata builder
- Clean up readme
- Non composer loader

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~1 days

Total

5

Last Release

2130d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.5

1.1.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3559c910d8b357b2ef1e3701c1120156cfada19cfaedd35b779861f24e99ece6?d=identicon)[ayoolatj](/maintainers/ayoolatj)

---

Top Contributors

[![ayoolatj](https://avatars.githubusercontent.com/u/1895357?v=4)](https://github.com/ayoolatj "ayoolatj (21 commits)")

---

Tags

subscriptiontransactionpaystackcustomerpaystack-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[unicodeveloper/laravel-paystack

A Laravel Package for Paystack

650975.6k11](/packages/unicodeveloper-laravel-paystack)[yabacon/paystack-php

Helps make your Paystack API calls giving a stdClass object.

117429.0k11](/packages/yabacon-paystack-php)[yanlongli/app-store-server-api

PHP client for App Store Server API. Manage your customers’ App Store transactions from your server.The App Store Server API is a REST API that you call from your server to request and provide information about your customers' in-app purchases. The App Store signs the transaction and subscription renewal information that this API returns using the JSON Web Signature (JWS) specification.App Store Server API is independent of the app’s installation status on the customer’s devices. The App Store server returns information based on the customer’s in-app purchase history regardless of whether the customer installed, removed, or reinstalled the app on their devices.To request transaction and subscription status information with this API, provide any original transaction identifier that belongs to the customer. The transaction history API responds with a complete list of transactions, 20 at a time, starting with the oldest first. The subscription status API returns the status for all of the customer’s subscriptions, organized by their subscription group identifier.Use the Send Consumption Information endpoint to send information to the App Store when customers request a refund for a consumable in-app purchase, after you receive the CONSUMPTION\_REQUEST App Store server notification. Your data helps inform refund decisions.

2532.0k](/packages/yanlongli-app-store-server-api)[digikraaft/laravel-paystack-subscription

A simple interface to Paystack's subscription billing services. It takes the pain of implementing subscription management off you.

231.2k](/packages/digikraaft-laravel-paystack-subscription)[prevailexcel/laravel-nowpayments

A Laravel Package for NOWPayments

1414.2k](/packages/prevailexcel-laravel-nowpayments)

PHPackages © 2026

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