Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Pesapal

Laravel Pesapal Laravel Package

njoguamos/laravel-pesapal

Laravel package for the Pesapal v3 API that generates and caches access tokens, stores Instant Payment Notifications in the database, and lets you submit order requests and check transaction statuses without rewriting integration code.

View on GitHub
Deep Wiki
Context7

A Laravel package for interacting with https://www.pesapal.com api

Frequently asked questions about Laravel Pesapal
How do I install njoguamos/laravel-pesapal in a Laravel application?
Run composer require njoguamos/laravel-pesapal, then publish the package assets with php artisan vendor:publish so the config file and migrations are copied into your app. The migrations create two tables, pesapal_tokens and pesapal_ipns, so finish by running php artisan migrate. After that you only need to add your Pesapal credentials and callback URLs to the published config.
Which Laravel versions does laravel-pesapal support?
The README version table lists the 1.x line for Laravel 10 and 11, and the 2.x line for Laravel 11 and 12, with the current 3.0.x releases continuing on modern Laravel. Laravel 10 applications should stay on the 1.x line rather than the latest major. Anything older than Laravel 10 is not supported and would require refactoring the package will not absorb.
How do I configure my Pesapal API credentials and callback URLs?
Publish the package config file and set your consumer key, consumer secret, callback URL, and IPN URL there, typically pulling the secrets from your .env file or config/services.php. The config is the single integration surface, so you can keep separate values per environment without touching package code. Never commit live Pesapal credentials; keep production keys in your environment or secret manager.
How does the package handle Pesapal access tokens and expiry?
The package requests an access token from the Pesapal v3 API and persists it in the pesapal_tokens table along with its expires_at timestamp. Because Pesapal tokens are short lived, around five minutes, the package checks expiry and regenerates the token automatically instead of making you request one on every call. This removes the most repetitive part of a Pesapal integration from your application code.
What are Instant Payment Notifications (IPNs) and how are they stored?
An IPN is the callback Pesapal posts to your application when a payment changes state. The package ships a pesapal_ipns table plus a model, so incoming notifications are persisted rather than handled in a stateless controller. You then reconcile the notification against your own order records, and package events such as pesapal.payment.created let you trigger fulfilment or customer notifications after payment.
How do I submit an order request to the Pesapal v3 API with this package?
Build the order details your checkout needs, such as amount, currency, description, and callback URL, then submit them through the package gateway or facade. The API responds with a redirect URL that you send the customer to so they can complete payment on Pesapal. Amount formatting and the callback URL must match what you configured, otherwise Pesapal will reject the request or redirect to the wrong place.
How do I check the status of a Pesapal transaction?
The gateway exposes a transaction status query that you call with the order tracking ID returned when the order was submitted. Use it for reconciliation, for polling while a customer is on the Pesapal page, and as a fallback when an IPN is delayed or never arrives. Treat the status query as the source of truth before marking an order as paid in your database.
Can I test this package without creating a new Laravel project?
Yes. The maintainer publishes a separate laravel-pesapal-playground repository specifically for trying the package without scaffolding a fresh Laravel app. For automated tests, the HTTP layer is built on Saloon, so you can mock the connector and assert request and response handling without hitting Pesapal. Always run the full payment regression suite, covering success, failure, timeout, and idempotency, before promoting a dependency upgrade.
Is laravel-pesapal safe to use in production, and what are the maintenance risks?
Production runtime risk is low because the package delegates HTTP transport to saloonphp/saloon and recent 3.0.x releases are dependency bumps rather than behavioural rewrites. The real risks are sustainability ones: it is a single-maintainer package, and successive releases have contained only automated dependency updates with no new Pesapal capabilities or webhook hardening. Pin your lockfile, review the Saloon diff on upgrade, and keep a documented direct Pesapal API fallback for critical payment flows.
Can I use this package outside Laravel or as an alternative to a custom Pesapal integration?
No. The package is tightly coupled to Laravel through its service provider, facade, config publishing, and Eloquent models, so it is not portable to a standalone PHP or non-Laravel payment service. It is also a thin abstraction: Pesapal API 3.0 semantics still leak into your application code, and workflows like subscriptions, refunds, and webhook reconciliation remain your responsibility. If you need a framework-agnostic client or full domain modelling of payments, a custom integration against the Pesapal v3 API is the better fit.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections