Download the PHP package codejutsu1/laravel-paystack-transfer without Composer
On this page you can find all versions of the php package codejutsu1/laravel-paystack-transfer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codejutsu1/laravel-paystack-transfer
More information about codejutsu1/laravel-paystack-transfer
Files in codejutsu1/laravel-paystack-transfer
Package laravel-paystack-transfer
Short Description An Elegant laravel package to make single and bulk transfers using paystack.
License MIT
Homepage https://github.com/codejutsu1/laravel-paystack-transfer
Informations about the package laravel-paystack-transfer
Laravel Paystack Transfer
A Laravel package to make single and bulk transfers with Paystack.
Installation
PHP 8.2+ and Composer are required.
Compatible with Laravel 9, 10, 11.
-
Install the package via composer:
-
Optional
you can publish the config file via this command:A configuration file named
paystack-transfer.php
will be placed in theconfig
folder of your laravel application:
Usage
Open your .env
file and add your public and secret API keys.
Table of Contents
- Transfer Recipient
- Create Single Transfer Recipient
- Create Bulk Transfer Recipient
- List Transfer Recipients
- Fetch a Transfer Recipient
- Update a Transfer Recipient
- Delete a Transfer Recipient
- Banks
- Get Banks API
- Get Bank Code
- Verify Account Number
- Transfers
- Single Transfers
- Finalize a Transfer (When OTP is enabled for single Transfers)
- Bulk Transfers
- List Transfers
- Fetch a Transfer
- Verify a Transfer
Payment Flow
-
To make a transfer, either single or in bulk using this package, you need to provide an array of four parameters:
- amount - Amount to be sent.
- reference (Transfer Reference) - A unique identifier which will be used to track your transactions. This package provides a helper function,
generateTransferReference()
, which returns a UUID you can use as a unique reference. - recipient (Transfer Recipient) - A transfer recipient is a beneficiary that you can send money to. To create a transfer recipient, you need to collect their details first.
- reason - Reason for the transfer.
- currency - (Optional)
NGN
by default but you can specify your currency.
- Each request returns a response as an object containing:
- status (boolean)
- message (string)
- data (array)
- meta (array)
Transfer Recipient
Create Single Transfer Recipient
To create a single transfer recipient:
[!IMPORTANT] Store the recipient_code in your database alongside the recipient. For more information, visit Paystack Create Transfer Recipient.
Create Bulk Transfer Recipient
You can create multiple transfer recipient no matter the number of batches. To create multiple transfer recipient:
[!NOTE] For more information, visit Paystack Bulk Create Transfer Recipient
List Transfer Recipients
To list all transfer recipients:
You can also provide query parameters as an array:
[!NOTE] For more information, visit Paystack List Transfer Recipients.
Fetch a Transfer Recipient
To fetch a transfer recipient, you need to provide the id or recipient code of the recipient:
[!NOTE] For more information, visit Paystack Fetch Transfer Recipient.
Update a Transfer Recipient
To update a transfer recipient details, you need to provide the id or recipient code of the recipient alongside the details to be updated (name and/or email):
[!NOTE] For more information, visit Paystack Update Transfer Recipient.
Delete a Transfer Recipient
To delete a transfer recipient, you need to provide the id or recipient code of the recipient:
[!NOTE] For more information, visit Paystack Delete Transfer Recipient.
Banks
Get Banks API
To get lists of banks in Nigeria:
You can also provide query parameters as an array:
[!NOTE] For more information, visit Paystack List Banks API.
Get Bank Code
To get a bank code, you need to provide the bank name from the get bank API:
Verify Account Number
To confirm the account belongs to the right customer, you need to provide the account number and the bank code of the customer as both strings:
[!NOTE] For more information, visit Paystack Resolve Account.
Transfers
Single Transfers
To make a single transfers, you need these provide four parameters as an array:
- reason
- amount
- reference
- recipient
The currency
is NGN
by default. You can override the default currency by adding it to the array. For the source
, we took care of that by merging the array with a value of balance
.
[!NOTE] For more information, visit Paystack Single Transfers.
Finalize a Transfer
After making a single transfer with OTP enabled
, you will have to finalized your transfer by providing the OTP
and the transfer code
as both strings:
[!NOTE] For more information, visit Paystack Finalize Transfers.
Bulk Transfers
To send money to multiple recipients, you need to make request in batches
. A batch
is an array of arrays containing the transfer parameters. A batch
should not contain more than 100 arrays
.
If the batch should contain more than 100 arrays, it should be broken down into batches, each containing 100 arrays and each batch should be sent every 5 seconds
.
But you don't have to worry about that, just pass the batch (even if its contains more than 100 arrays) as a parameter in the batchTransfer
method. This package will proceed to break it down into batches, each containing not more than 100 arrays and will make a request every 5 seconds.
[!Note] It will return an array of response instead of an object for each request being made.
[!Note] You need to set up webhooks to keep track of your transfers. For more information, visit Paystack Bulk Transfers.
List Transfers
Paystack gives you the option to get the list of all your transfers:
You can also provide query parameters as an array:
[!NOTE] For more information, visit Paystack List Transfers.
Fetch a Transfer
Get details of a transfer. You need to provide transfer id.
[!NOTE] For more information, visit Paystack Fetch Transfers.
Verify a Transfer
Verify the status of a transfer. You need to provide transfer reference.
[!NOTE] For more information, visit Paystack Verify Transfers.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Feel free to submit Issues (for bugs or suggestions) and Pull Requests(to the dev branch).
Security Vulnerabilities
If you discover a security vulnerability within this package, please send an email to Daniel Dunu at [email protected]. All security vulnerabilities will be promptly addressed..
TODO
- Write test for integrating third party APIs.
- If your business is a
registered business
, test the transfer feature with your test API Keys and give feedbacks.
Credits
- Daniel Dunu
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-paystack-transfer with dependencies
illuminate/contracts Version ^9.0 ||^10.0||^11.0
laravel/framework Version ^9.0 || ^10.0 || ^11.0
saloonphp/saloon Version ^3.8
spatie/laravel-package-tools Version ^1.16