Download the PHP package myckhel/laravel-paystack without Composer
On this page you can find all versions of the php package myckhel/laravel-paystack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-paystack
Laravel Paystack
Laravel wrapper for the Paystack API, built for direct use in controllers, services, and queued jobs.
Features
- Covers a broad set of Paystack endpoints (transactions, customers, transfers, plans, subscriptions, disputes, refunds, and more).
- Optional built-in HTTP routes for quick API proxying from your Laravel app.
- Built-in webhook route with signature validation and event dispatching.
- Compatible with Laravel
10,11,12, and13.
Installation
Laravel package auto-discovery will register the service provider and facade alias automatically.
Configuration
Publish config:
Set your credentials in .env:
Default config (config/paystack.php):
Quick Usage
Call support classes directly:
Developer Integration Scenarios
Here are common design patterns for using this package across different parts of a Laravel application.
1. Controllers (Checkout & Verification)
Controllers should initiate payments and handle callback verification. When an API call fails, the package automatically calls Laravel's abort(), throwing a Symfony\Component\HttpKernel\Exception\HttpException which is caught by Laravel's global exception handler.
2. Service Classes (Business Logic Isolation)
For larger applications, abstract Paystack calls into a service layer to keep controllers clean. This is especially useful for managing complex customer profiles, plans, or subscriptions.
3. Queued Jobs (Background Processing)
When interacting with the Paystack API inside queued jobs (e.g. processing bulk transfers or validating statuses in the background), network errors or rate limits (429 Too Many Requests) can occur.
You should design your jobs to handle these failures gracefully and support retries:
4. Error Handling
Because the package uses Laravel's HTTP client under the hood, any failed response (status codes 4xx and 5xx) automatically throws a Symfony\Component\HttpKernel\Exception\HttpException via abort($res->status(), ...).
You can catch this in your application code for fine-grained error handling:
Available Support Classes
ApplePayBulkChargeChargeControlPanelCustomerDedicatedVirtualAccountDisputeInvoiceMiscellaneousOrderPagePlanProductRecipientRefundSettlementSplitSubAccountSubscriptionTerminalTransactionTransferTransferControlVerificationVirtualTerminal
See class methods in src/Support/*.
Built-In Routes
The package registers route definitions from src/routes.php. By default, API routes are disabled through the paystack_route_disabled middleware.
To enable built-in routes, remove paystack_route_disabled from paystack.route.middleware in config/paystack.php.
Default route prefix is api, so endpoints resolve like:
POST /api/transaction/initializeGET /api/transaction/verify/{reference}POST /api/customer
Webhooks
Webhook endpoint:
POST /api/hooks(route is registered asRoute::any, but Paystack should call it withPOST)
Incoming webhook requests are validated by the validate_paystack_hook middleware using your PAYSTACK_SECRET_KEY.
Each valid incoming webhook dispatches the Binkode\Paystack\Events\Hook event.
Create a listener:
Example listener:
Testing
Useful Links
Contributing
Please read CONTRIBUTING.md.
Security
If you discover any security-related issues, email [email protected] instead of opening a public issue.
License
Released under the MIT License.
All versions of laravel-paystack with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.2