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

ActiveLibrary[Payment Processing](/categories/payments)

aweklin/paystack
================

A clean, simple, yet, comprehensive Paystack API wrapper for seamlessly managing your online transactions, transfers, and refunds with ease in PHP!

2251PHP

Since Jun 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/aweklin/Paystack-PHP)[ Packagist](https://packagist.org/packages/aweklin/paystack)[ RSS](/packages/aweklin-paystack/feed)WikiDiscussions Main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Paystack-PHP
============

[](#paystack-php)

 [![Github top language](https://camo.githubusercontent.com/91969a8f2cb392698496858f116cfe523cd0a7901bf28c523227734aeb43e7d4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/91969a8f2cb392698496858f116cfe523cd0a7901bf28c523227734aeb43e7d4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![Github language count](https://camo.githubusercontent.com/3192b3fac3805a8d2b660ffbf33f8a970c9fc4e02f2d1b37464d1bc52418f8d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f756e742f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/3192b3fac3805a8d2b660ffbf33f8a970c9fc4e02f2d1b37464d1bc52418f8d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f756e742f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![Repository size](https://camo.githubusercontent.com/8b89f38900600100675c3d80f95f3af0521a5e206087ec100bdf06fcf8077faf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/8b89f38900600100675c3d80f95f3af0521a5e206087ec100bdf06fcf8077faf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![License](https://camo.githubusercontent.com/122058126dbc3442c8d64b839d73a7e903679d4063776d9f6fcb45f2010e4f3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/122058126dbc3442c8d64b839d73a7e903679d4063776d9f6fcb45f2010e4f3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![Github issues](https://camo.githubusercontent.com/2ac8fa8e72eb9988bd654989d870bbc8d5632782fe6e0b29e1cad48fa78ece86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/2ac8fa8e72eb9988bd654989d870bbc8d5632782fe6e0b29e1cad48fa78ece86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![Github forks](https://camo.githubusercontent.com/01769d410fceaf1d117d21c8f8c668a96ab82cb72ea2bff841552f8a300070d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/01769d410fceaf1d117d21c8f8c668a96ab82cb72ea2bff841552f8a300070d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238) [![Github stars](https://camo.githubusercontent.com/0d2e487d79fa98c860dd9eb5e24b3a4ef83c85c2f090e062a7941aaafa400362/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)](https://camo.githubusercontent.com/0d2e487d79fa98c860dd9eb5e24b3a4ef83c85c2f090e062a7941aaafa400362/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6177656b6c696e2f706179737461636b2d7068703f636f6c6f723d353642454238)

 [About](#about) | [Requirements](#requirements) | [Installation](#installation) | [Usage](#usage) | [License](#license) | [Author](https://github.com/aweklin)

About
-----

[](#about)

A clean, simple, yet, comprehensive Paystack Library for seamlessly managing your online transactions, transfers, and refunds with ease in PHP!

This library adopts best programming practices to provide an easy way to carry out any form of transaction available on the Paystack API.

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

[](#requirements)

- Minimum of PHP 7.2

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

[](#installation)

To install using composer, invoke the command below:

```
composer require aweklin/paystack

```

You can also clone this repository using the command below:

```
git clone https://github.com/aweklin/Paystack-PHP

```

Usage
-----

[](#usage)

- [Initializing the Library](#initializingTheLibrary)
- [Transactions](#transactions)
- [Refunds](#refunds)
- [Transfers](#transfers)
- [Misc](#others)

Initializing the Library
========================

[](#initializing-the-library)

 Before you can use this library, you first need to initialize it in your program entry point, perhaps the index.php file. Simply use this line below to initialize the library.

 First, include the autoload file where you want to use it

 `      include_once 'path_to_klin_paystack/autoload.php';  ` Then, reference the namespace at the top of the file

 `    use Aweklin\Paystack\Paystack;  ` Next, initialize the Library with your secret key

 `    Paystack::initialize('your_api_secret_key_here');  `### **Important Notes:**

[](#important-notes)

Note that every requests made returns a uniform response

You can invoke `$result->hasError()` to determine if your request returns with an error and you can subsequently call `$result->getMessage()` for the success or error message. In addition, `$result->getData()` contains data from Paystack.

 When listing records, note that you can specify additional two parameters, which are: `$pageNumber` and `$pageSize`. However, this is not applicable to `Paystack::getBanks` and `Paystack::getProviders`.

 Where currency is required part of parameters, you can specify one of the enums: `Paystack::CURRENCY_NGN`, `Paystack::CURRENCY_GHS`, and `Paystack::CURRENCY_USD`.

 When supplying date values, please use the yyyy-MM-dd format.

Transactions
============

[](#transactions)

### Transaction listing

[](#transaction-listing)

To list all your transactions, invoke

 `$transactionList = Paystack::getTransactions();if ($transactionList->hasError()) {  echo $transactionList->getMessage();} else {  var_dump ($transactionList->getData());}  `Or, specify the page number and page size

 `  $transactionList = Paystack::getTransactions($pageNumber, $pageSize);  if ($transactionList->hasError()) {    echo $transactionList->getMessage();  } else {    var_dump ($transactionList->getData());  }  `To list all your transactions by status, invoke

 `  $transactionList = Paystack::getTransactions($status);  if ($transactionList->hasError()) {    echo $transactionList->getMessage();  } else {    var_dump ($transactionList->getData());  }  `Or, specify page number and page size

 `  $transactionList = Paystack::getTransactions($status, $pageNumber, $pageSize);    if ($transactionList->hasError()) {    echo $transactionList->getMessage();  } else {    var_dump ($transactionList->getData());  }  `$status can be one of `Transaction::STATUS_SUCCESS`, `Transaction::STATUS_FAILED`, or `Transaction::STATUS_ABANDONED`

To list all your transactions by date range, invoke

 `  $transactionList = Paystack::getTransactions($startDate, $endDate);    if ($transactionList->hasError()) {    echo $transactionList->getMessage();  } else {    var_dump ($transactionList->getData());  }  `**Date format: yyyy-MM-dd, example: '2020-09-25'**

To list all your transactions by by other parameter(s), invoke

 `  $transactionParameter = new TransactionParameter();        $transactionParameter        ->setCustomerId(111222333)        ->setStatus(Transaction::STATUS_SUCCESS)        ->setAmount(1000)        ->setCurrency(Paystack::CURRENCY_NGN);  $transactionList = Paystack::getTransactions($transactionParameter);  if ($transactionList->hasError()) {    echo $transactionList->getMessage();  } else {    var_dump ($transactionList->getData());  }  `
 Note that you can set only one or more than one parameter to filter transactions as show above. The TransactionParameter object allows you to chain parameters.

 The `setStatus(?)` method can take one of the enums: `Transaction::STATUS_SUCCESS, Transaction::STATUS_FAILED, Transaction::STATUS_ABANDONED`.

 Also, the `setCurrency(?)` method accepts one of the enums: `Paystack::CURRENCY_NGN`, `Paystack::CURRENCY_GHS`, and `Paystack::CURRENCY_USD`

### Transaction initiation

[](#transaction-initiation)

You can initiate a transaction by simply passing an email and amount.

### Initiating payment with email and amount

[](#initiating-payment-with-email-and-amount)

 This allows you to generate an authorization url, with which the user can use to complete his payment.

Example

 `$result = Paystack::initiateTransaction(VALID_EMAIL, VALID_AMOUNT);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Initiating payment with email, amount, and reference

[](#initiating-payment-with-email-amount-and-reference)

You can also include a reference number for your transaction:

 `$result = Paystack::initiateTransaction(VALID_EMAIL, VALID_AMOUNT, 'ref_no');if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Initiating payment with email, amount, and currency

[](#initiating-payment-with-email-amount-and-currency)

You can also include a currency for your transaction:

 `$result = Paystack::initiateTransaction(VALID_EMAIL, VALID_AMOUNT, 'currency');if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Initiating payment with email, amount, and custom\_fields

[](#initiating-payment-with-email-amount-and-custom_fields)

You can also include an array of custom fields as shown below:

 `$result = Paystack::initiateTransaction(VALID_EMAIL, VALID_AMOUNT, ['name' => 'Akeem Aweda', 'profession' => 'Software Engineer']);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Initiating payment with email, amount, reference, currency and custom fields

[](#initiating-payment-with-email-amount-reference-currency-and-custom-fields)

You can also include reference, currency and an array of custom fields as shown below:

 `$result = Paystack::initiateTransaction(VALID_EMAIL, VALID_AMOUNT, 'reference', 'currency', ['name' => 'Akeem Aweda', 'profession' => 'Software Engineer']);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Creating a transaction charge

[](#creating-a-transaction-charge)

You can initiate a transaction by creating a transaction charge via Bank, Mobile Money, Transfer, QR Code, or USSD API.

### Initiating mobile money payment

[](#initiating-mobile-money-payment)

 Allows you to carry out a mobile money transaction based on available providers.

Example

 `$mobileMoney = new MobileMoneyPayment('email@domain.com', 5000, 'NGN', '07020000000', 'Airtel');$chargeResult = Paystack::initiateTransaction($mobileMoney);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Initiating bank payment

[](#initiating-bank-payment)

 Allows you to carry out a bank transaction either via USSD or by transfer.

Example

 `$bankPayment = new BankPayment('email@domain.com', 5000, '058', VALID_ACCOUNT_NUMBER);$chargeResult = Paystack::initiateTransaction($bankPayment);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Initiating USSD payment

[](#initiating-ussd-payment)

 This Payment method is specifically for Nigerian customers. Nigerian Banks provide USSD services that customers use to perform transactions, and we've integrated with some of them to enable customers complete payments.

The Pay via USSD channel allows your Nigerian customers to pay you by dialling a USSD code on their mobile device. This code is usually in the form of \* followed by some code and ending with #. The user is prompted to authenticate the transaction with a PIN and then it is confirmed.

Example

 `$ussdPayment = new USSDPayment(VALID_EMAIL, VALID_AMOUNT, USSDPayment::BANK_GUARANTEE_TRUST);$chargeResult = Paystack::initiateTransaction($ussdPayment);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Initiating QR Code payment

[](#initiating-qr-code-payment)

 The QR option generates a QR code which allows customers to use their bank's mobile app to complete payments. We currently have only Visa QR option available. We'll have more options later.

```
When the customer scans the code, they authenticate on their bank app to complete the payment. When the user pays, a response will be sent to your webhook. This means that you need to have webhooks set up on your Paystack Dashboard.

```

Example

 `$qrCodePayment = new QRCodePayment(VALID_EMAIL, VALID_AMOUNT, QRCodePayment::PROVIDER_VISA);$chargeResult = Paystack::initiateTransaction($qrCodePayment);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Initiating a recurring payment

[](#initiating-a-recurring-payment)

 Allows you to process a recurring payment by charging the authorization code earlier received.

Please note that this requires a valid authorization code.

Example

 `$recurringPayment = new RecurringPayment(VALID_EMAIL, VALID_AMOUNT, VALID_AUTHORIZATION_CODE);$chargeResult = Paystack::initiateTransaction($recurringPayment);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Completing transaction with OTP

[](#completing-transaction-with-otp)

Concludes a payment process initiated via bank payment method.

Example

 `$chargeResult = Paystack::completeTransactionWithOTP($reference, $otp);if ($chargeResult->hasError()) {  echo $chargeResult->getMessage();} else {  var_dump ($chargeResult->getData());}  `### Transaction verification

[](#transaction-verification)

To verify a transaction, you need to first obtain a transaction reference to be used for the check.

Example

 `$verificationResult = Paystack::verifyTransaction('abcd');if ($verificationResult->hasError()) {  echo $verificationResult->getMessage();} else {  var_dump ($verificationResult->getData());}  `

Refunds
=======

[](#refunds)

Allows you create and manage transaction refunds.

### Initiating a refund for a given transaction reference.

[](#initiating-a-refund-for-a-given-transaction-reference)

Example

 `$refundResult = Paystack::initiateRefund($reference);if ($refundResult->hasError()) {  echo $refundResult->getMessage();} else {  var_dump ($refundResult->getData());}  ` [](#--example--refundresult--paystackinitiaterefundreferenceif-refundresult-haserror---echo-refundresult-getmessage-else---var_dump-refundresult-getdata------)

### Checking refund status

[](#checking-refund-status)

It may take up to 24 hours for your refund to be concluded. To check if your refund was successful, invoke

 `$refundCheck = Paystack::getRefund($reference);if ($refundCheck->hasError()) {  echo $refundCheck->getMessage();} else {  var_dump ($refundCheck->getData());}  `### Listing your refunds

[](#listing-your-refunds)

Return all refunds from inception till date.

 `$refundList = Paystack::getRefunds();if ($refundList->hasError()) {  echo $refundList->getMessage();} else {  var_dump ($refundList->getData());}  `### Listing your refunds by date range

[](#listing-your-refunds-by-date-range)

 `$refundList = Paystack::getRefundsByDates($startDate, $endDate);if ($refundList->hasError()) {  echo $refundList->getMessage();} else {  var_dump ($refundList->getData());}  `### Listing your refunds by other parameters

[](#listing-your-refunds-by-other-parameters)

 `$transactionParameter = new RefundParameter();$transactionParameter->setCurrency(Paystack::CURRENCY_NGN);$refundList = Paystack::getRefundsBy($transactionParameter);if ($refundList->hasError()) {  echo $refundList->getMessage();} else {  var_dump ($refundList->getData());}  `

Transfers
=========

[](#transfers)

Allows you send money.

### Transfer to beneficiary

[](#transfer-to-beneficiary)

 Initiates a single transfer request to a beneficiary.

```
Status of transfer object returned will be pending if OTP is disabled. In the event that an OTP is required, status will read otp.

```

Please note that the beneficiary must have been previously added to your beneficiary list, please refer to Misc section.

Example

 `$transferResult = Paystack::initiateTransferToBeneficiary(VALID_BENEFICIARY_CODE, VALID_AMOUNT, 'reference', Paystack::CURRENCY_NGN, 'Testing transfer.');if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `
 Note that the reference is optional, so it can be empty (to allow Paystack generate a transaction reference for you, and it's part of the `$transferResult->getData()` data).

### Transfer to bank account

[](#transfer-to-bank-account)

 Initiates a single transfer request to an account number.

```
Note that this method will have to validate the account number, create the beneficiary, then transfer to the beneficiary.

Status of transfer object returned will be pending if OTP is disabled. In the event that an OTP is required, status will read otp.

```

Example

 `$transferResult = Paystack::initiateTransferToAccount($accountNumber, $accountName, $bankCode, $amount, $reference, $currency, $remark);if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  ` \* @param string $accountNumber Receiver's account number.
\* @param string $accountName Receiver's account name.
\* @param string $bankCode Receiver's bank code. You can get the list of Bank Codes by calling the ``Aweklin\Paystack\Core\DataProvider::getBanks()`` method.
\* @param float $amount Amount to be transferred.
\* @param string $reference If specified, the field should be a unique identifier (in lowercase) for the object. Only -,\_ and alphanumeric characters allowed.
\* @param string $currency Three-letter ISO currency.
\* @param string $remark The reason for the transfer.

### Bulk transfer

[](#bulk-transfer)

 Initiates a bulk transfer request.

```
You need to disable the Transfers OTP requirement to use this endpoint.

```

Example

 `$transferResult = Paystack::initiateBulkTransfers($transfers, $currency);if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  ` **$transfers is an array of `\Aweklin\Paystack\Models\PaymentTransfer``, each containing: amount, recipient, and reference.**

### Conclude transfer with OTP

[](#conclude-transfer-with-otp)

 Finalizes an initiated transfer with OTP.

Example

 `$transferResult = Paystack::completeTransferWithOTP($transferCode, $otp);if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `### Resend transfer OTP

[](#resend-transfer-otp)

 Generates a new OTP and sends to customer in the event they are having trouble receiving one.

Example

 `$transferResult = Paystack::resendTransferOTP($transferCode);if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `### Disable transfer OTP

[](#disable-transfer-otp)

 In the event that you want to be able to complete transfers programmatically without use of OTPs, this method helps disable that….with an OTP.

```
Please note that this will send you an OTP and you are to call the `finalizeDisableOTP()` method to conclude operation.

```

Example

 `$transferResult = Paystack::disableOTP();if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `### Complete disable transfer OTP

[](#complete-disable-transfer-otp)

 Finalizes the request to disable OTP on your transfers.

Example

 `$transferResult = Paystack::finalizeDisableOTP($otp);if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `### Enable transfer OTP

[](#enable-transfer-otp)

 In the event that a customer wants to stop being able to complete transfers programmatically, this endpoint helps turn OTP requirement back on.

Example

 `$transferResult = Paystack::enableOTP();if ($transferResult->hasError()) {  echo $transferResult->getMessage();} else {  var_dump ($transferResult->getData());}  `

### Listing your transfers

[](#listing-your-transfers)

Return all transfers from inception till date.

 `$transferList = Paystack::getTransfers();if ($transferList->hasError()) {  echo $transferList->getMessage();} else {  var_dump ($transferList->getData());}  `### Listing your transfers by date range

[](#listing-your-transfers-by-date-range)

 `$transferList = Paystack::getTransfersByDates($startDate, $endDate);if ($transferList->hasError()) {  echo $transferList->getMessage();} else {  var_dump ($transferList->getData());}  `### Get details of a transfer

[](#get-details-of-a-transfer)

 `$transferDetails = Paystack::getTransfer($id);if ($transferDetails->hasError()) {  echo $transferDetails->getMessage();} else {  var_dump ($transferDetails->getData());}  `

Misc
====

[](#misc)

### Get account balance

[](#get-account-balance)

 `$result = Paystack::getBalance();if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Get list of banks

[](#get-list-of-banks)

Get a list of all Nigerian banks and their properties

 `$result = Paystack::getBanks();if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Get providers

[](#get-providers)

Get a list of all providers for Dedicated NUBAN

 `$result = Paystack::getProviders();if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Validate BVN

[](#validate-bvn)

Validates the given Bank Verification Number, BVN against the account number and bank code provided.

 `$result = Paystack::verifyBVN(VALID_BVN, VALID_BANK_CODE_FOR_BVN_VERIFICATION, VALID_ACCOUNT_NUMBER);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Get account balance.

[](#get-account-balance-1)

Get a customer's information by using the Bank Verification Number.

 `$result = Paystack::getBVNDetails($bvn);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Get account balance.

[](#get-account-balance-2)

Confirm an account belongs to the right customer.

 `$result = Paystack::getAccountDetails(string $accountNumber, string $bankCode);if ($result->hasError()) {  echo $result->getMessage();} else {  var_dump ($result->getData());}  `### Adding transfer beneficiary

[](#adding-transfer-beneficiary)

 Creates a new recipient. A duplicate account number will lead to the retrieval of the existing record.

 `$beneficiaryCreationResult = Paystack::createBeneficiary(VALID_ACCOUNT_NUMBER, VALID_BANK_CODE_FOR_BVN_VERIFICATION, VALID_ACCOUNT_NAME);if ($beneficiaryCreationResult->hasError()) {  echo $beneficiaryCreationResult->getMessage();} else {  var_dump ($beneficiaryCreationResult->getData());}  `### Updating transfer beneficiary

[](#updating-transfer-beneficiary)

 Updates recipient. A duplicate account number will lead to the retrieval of the existing record.

 `$beneficiaryUpdateResult = Paystack::updateBeneficiary(VALID_BENEFICIARY_ID, VALID_ACCOUNT_NAME, VALID_EMAIL, 'A sample test account');if ($beneficiaryUpdateResult->hasError()) {  echo $beneficiaryUpdateResult->getMessage();} else {  var_dump ($beneficiaryUpdateResult->getData());}  `### Listing transfer beneficiaries

[](#listing-transfer-beneficiaries)

 Returns all beneficiaries created from inception till date.

 `$beneficiaries = Paystack::getBeneficiaries();if ($beneficiaries->hasError()) {  echo $beneficiaries->getMessage();} else {  var_dump ($beneficiaries->getData());}  `### Listing transfer beneficiaries created between two dates

[](#listing-transfer-beneficiaries-created-between-two-dates)

 Returns all beneficiaries created between two dates.

 `$beneficiaries = Paystack::getBeneficiariesByDates($startDate, $endDate);if ($beneficiaries->hasError()) {  echo $beneficiaries->getMessage();} else {  var_dump ($beneficiaries->getData());}  `### Get details of a beneficiary.

[](#get-details-of-a-beneficiary)

 `$beneficiaryDetails = Paystack::getBeneficiary(VALID_BENEFICIARY_ID);if ($beneficiaryDetails->hasError()) {  echo $beneficiaryDetails->getMessage();} else {  var_dump ($beneficiaryDetails->getData());}  `

Testing
-------

[](#testing)

This project has been developed with TDD. Over 95% of the code has been unit tested and improved overtime. With the unit testing in place, developers using this library can equally learn how to use it simply by reading through the tests written.

To run the unit tests in this project, kindly open the `config.php` file inside the `tests` folder and set the appropriate values for all the constants before running your tests. If you need some help on this, kindly contact [](mailto:akeem@aweklin.com "Send email to").

Contributions
-------------

[](#contributions)

This project is open to professionals to contribute &amp; report issues for us to make it better together. Security issues should be reported privately, via email, to [](mailto:akeem@aweklin.com "Send email to").

License
-------

[](#license)

This project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file.

Made with ❤️ by [Akeem Aweda](https://github.com/aweklin)

[Back to top](#top)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/36bf0578f4e433f528a917d9120f85353e1359b73c019e8863acc201648de7df?d=identicon)[aweklin.com](/maintainers/aweklin.com)

---

Top Contributors

[![aweklin](https://avatars.githubusercontent.com/u/5461083?v=4)](https://github.com/aweklin "aweklin (6 commits)")[![fcmbpensionsdev](https://avatars.githubusercontent.com/u/46710627?v=4)](https://github.com/fcmbpensionsdev "fcmbpensionsdev (5 commits)")

### Embed Badge

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

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

###  Alternatives

[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.2k](/packages/msilabs-bkash)[binkode/laravel-paystack

A description for laravel-paystack.

112.1k](/packages/binkode-laravel-paystack)

PHPackages © 2026

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