iamolayemi / laravel-paystack
A laravel package for working with paystack api
Requires
- php: ^8.1|^8.2
- guzzlehttp/guzzle: ^7.3
- illuminate/support: ^9.0|^10.0
Requires (Dev)
- laravel/pint: ^1.10
- nunomaduro/collision: 6.0|^7.0
- orchestra/testbench: ^7.0|^8.0
- phpunit/phpunit: ^9.0|^10.0
This package is auto-updated.
Last update: 2024-12-08 05:14:02 UTC
README
This package provides an expressive and convenient way to interact with the Paystack API within your Laravel Application.
Installation
Requires PHP 8.1+
You can install the package via composer:
composer require iamolayemi/laravel-paystack
Usage
Open your .env file and add your public key, secret key, callback url and webhook:
PAYSTACK_PUBLIC_KEY=pk_xxxxxxxxxxxxx PAYSTACK_SECRET_KEY=sk_xxxxxxxxxxxxx
This package provides some fluent interface to interact with the paystack api. To learn all about it, head over to the extensive documentation.
Here are some of the things you can do with this package.
/** * Initialize a new payment, and return the response from the api call */ Paystack::transaction()->initialize($paymentData)->response(); /** * Using the helper function */ paystack()->transaction()->initialize($paymentData)->response();
You can also get a specific data from the api call by passing in the key of the data you want to return as an argument in the response() method
/** * Initialize a new payment, and return only the authorization url */ Paystack::transaction()->initialize($paymentData)->response('data.authorization_url'); /** * Using the helper function */ paystack()->transaction()->initialize($paymentData)->response('data.authorization_url');
Alternatively, this package also provide another fluent method that make it easy to fetch only the authorization url.
/** * Initialize a new payment, and return the authorization url */ Paystack::transaction()->initialize($paymentData)->authorizationURL(); /** * Using the helper function */ paystack()->transaction()->initialize($paymentData)->authorizationURL();
Documentation
You'll find the documentation on https://laravel-paystack.netlify.app.
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email olatayo.olayemi.peter@gmail.com instead of using the issue tracker.
Credits
Alternatives
License
The MIT License (MIT). Please see License File for more information.