Download the PHP package matscode/paystack-laravel-sdk without Composer
On this page you can find all versions of the php package matscode/paystack-laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package paystack-laravel-sdk
Paystack Laravel SDK
A modern, maintainable, and extensible Paystack integration for Laravel, built on top of the matscode/paystack-php-sdk. Feel free to reference the main SDK to see other available api method/property
Features
- Clean, service-based Paystack API integration
- Laravel service provider and facade
- Global
paystack()
helper for convenient access - Uses matscode/paystack-php-sdk under the hood
- Configurable via
config/paystack.php
- Well-documented
Requirements
- PHP 8.0+
- Laravel 9.0+
- matscode/paystack-php-sdk (installed automatically)
Installation
Install via Composer:
Configuration
Optionally, publish the config file:
Set your Paystack secret key in your .env
file:
Usage
You can use the Paystack SDK in Laravel via:
- The
Paystack
Facade (recommended) - Dependency Injection (
Matscode\Paystack\Paystack
) - The
paystack()
helper (just likerequest()
orauth()
)
Note:
Access Style Facade ( Paystack
)DI ( app(...)
)Helper ( paystack()
)Method call ✅ Yes ✅ Yes ✅ Yes Property access ❌ No ✅ Yes ✅ Yes
- For the Facade, you must use static method calls for resources, such as
Paystack::transaction()
. Property access likePaystack::transaction
will not work.- For DI and the helper, both method calls (
->transaction()
) and property access (->transaction
) are supported.- Always use the method call syntax for maximum compatibility.
Transaction Resource
Initialize Transaction
Initializes a new transaction and returns an authorization URL for the customer to complete payment. The response contains the transaction reference and other details.
List Transactions
Retrieves a list of all transactions carried out on your Paystack account. Returns an array of transaction objects.
Verify Transaction
Verifies the status of a transaction using its reference. Returns the transaction details if found.
Check if Transaction is Successful
Checks if a transaction was successful using its reference. Returns true
if successful, otherwise false
.
Example: Initializing a Transaction with the Paystack Facade (Laravel)
You can use the Paystack facade with method chaining to initialize a transaction and get the payment authorization URL:
setCallbackUrl()
sets the URL Paystack will redirect to after payment.setEmail()
sets the customer's email.setAmount()
sets the amount (in Naira, not kobo, when using this method).initialize()
sends the request to Paystack and returns the response.- The authorization URL for redirecting the user is in
$response->data->authorization_url
.
If you want to use the array method (amount in kobo):
Bank Resource
List Banks
Retrieves a list of all supported banks for your Paystack account. Useful for populating bank selection dropdowns in forms.
Resolve Account Information
Resolves and validates a Nigerian bank account number and bank code. Returns the account name and other details if valid.
Note: More resources (Customers, Plans, Subscription, Transfers, etc.) may be added as the SDK evolves. For the latest, see the PHP SDK documentation.
License
This library is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for the full license text.