damms005 / laravel-multipay
An opinionated, easily extendable and configurable package for handling payments in Laravel
Fund package maintenance!
damms005
Requires
- php: ^8.1
- damms005/laravel-flutterwave: ^3.0
- flutterwavedev/flutterwave-v3: ^1.0
- guzzlehttp/guzzle: ^7.3
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- yabacon/paystack-php: ^2.2
Requires (Dev)
- doctrine/dbal: ^3.6
- larastan/larastan: ^3.0
- laravel/framework: 12.*
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- dev-main
- v6.0.1
- v6.0.0
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.10.3
- v3.10.2
- v3.10.1
- v3.10.0
- v3.9.4
- v3.9.3
- v3.9.2
- v3.9.1
- v3.9
- v3.8
- v3.7
- v3.6
- v3.5
- v3.4
- v3.3
- v3.2
- v3.1
- v3.0
- v2.6.26
- v2.6.25
- v2.6.24
- v2.6.23
- v2.6.22
- v2.6.21
- v2.6.20
- v2.6.18
- v2.6.17
- v2.6.16
- v2.6.15
- v2.6.14
- v2.6.13
- v2.6.12
- v2.6.11
- v2.6.10
- v2.6.9
- v2.6.8
- v2.6.7
- v2.6.6
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.7
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.9
- v2.3.8
- v2.3.7
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.0
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.27
- v2.0.26
- v2.0.25
- v2.0.24
- v2.0.23
- v2.0.22
- v2.0.21
- v2.0.20
- v2.0.19
- v2.0.18
- v2.0.17
- v2.0.16
- v2.0.15
- v2.0.14
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-patch-2
- dev-patch-1
This package is auto-updated.
Last update: 2025-08-23 14:23:03 UTC
README
An opinionated Laravel package to handle payments, complete with blade views, routing, and everything in-between.
Whether you want to quickly bootstrap payment processing for your Laravel applications, or you want a way to test supported payment processors, this package's got you!
Although opinionated, this package allows you to "theme" the views. It achieves this theming by
@extend()
ing whatever view you specify inconfig('laravel-multipay.extended_layout')
(defaults tolayout.app
).
Requirements:
This package is tested against:
- PHP ^8.2
- Laravel 11/12
Currently supported payment handlers
Currently, this package supports the following online payment processors/handlers
Note
key: ** for the indicated providers, a few features may be missing. PRs welcomed if you cannot afford the wait 😉
Tip
Your preferred payment handler is not yet supported? Please consider opening the appropriate issue type.
Tip
Adding a new payment handler is straight-forward. Simply add a class that extends Damms005\LaravelMultipay\Services\PaymentHandlers\BasePaymentHandler
and implement Damms005\LaravelMultipay\Contracts\PaymentHandlerInterface
Note
Payment providers that you so register as described above are resolvable from the Laravel Container to improve the flexibility of this package and improve DX.
Installation
composer require damms005/laravel-multipay
Publish the config file.
php artisan vendor:publish --tag=laravel-multipay-config
Run migrations.
php artisan migrate
Demo Repo
I published an open source app that uses this payment package. It is also an excellent example of a Laravel app that uses Laravel Vite and leverages on Laravel Echo to provide realtime experience via public and private channels using Laravel Websocket, powered by Livewire.
Test drive 🚀
Want to take things for a spin? Visit /payment/test-drive
(route('payment.test-drive')
provided by this package) .
For Paystack, ensure to set paystack_secret_key
key in the laravel-multipay.php
config file that you published previously at installation. You can get your key from your settings page.
Warning
Ensure you have TailwindCSS installed, then add this package's views to thecontent
key of yourtailwind.config.js
configuration file, like below:
content: [ ..., './vendor/damms005/laravel-multipay/views/**/*.blade.php', ], ...
Needed Third-party Integrations:
- Flutterwave: If you want to use Flutterwave, ensure to get your API details from the dashboard, and use it to set the following variables in your
.env
file:
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X FLW_SECRET_HASH=hash-123xxxxxxxxxxxxxxxxxxx-X
- Paystack: Paystack requires a secret key. Go to the Paystack dashboard to obtain one, and use it to set the following variable:
PAYSTACK_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxx
- Remita: Ensure to set the following environment variables:
REMITA_MERCHANT_ID=xxxxxxxxxxxxxxxxxxxxx REMITA_API_KEY=xxxxxxxxxxxxxxxxxxxxx
For most of the above environment variables, you should rather use the (published) config file to set the corresponding values.
Usage
Typical process-flow
Step 1
Send a POST
request to /payment/details/confirm
(route('payment.show_transaction_details_for_user_confirmation')
provided by this package).
Check the InitiatePaymentRequest form request class to know the values you are to post to this endpoint. (tip: you can also check test-drive/pay.blade.php).
This POST
request will typically be made by submitting a form from your frontend to the route described above.
Note
if you need to store additional/contextual data with this payment, you can include such data in the request, in a field named metadata
. The value must be a valid JSON string.
Step 2
Upon user confirmation of transaction, user is redirected to the appropriate payment handler's gateway.
Step 3
When user is done with the transaction on the payment handler's end (either successfully paid, or declined transaction), user is redirected
back to /payment/completed
(route('payment.finished.callback_url')
provided by this package) .
Metadata Usage
In the payment initiation request in Step 1, you can provide a metadata
field. This field is stored in the metadata
column of the payments
table, and available as AsArrayObject::class
property of the Payment
model and it provides powerful customization options for individual payments.
The metadata should be a valid JSON string containing key-value pairs that modify payment behavior.
Available Metadata Keys
completion_url
- After successful payment, the user will be redirected to the URL specified by this key instead of the default payment completion page
- When user is redirected to the specified URL, the transaction reference will be included as
transaction_reference
in the URL query string
payment_processor
- Use this key to dynamically set the payment handler for the specific transaction
- Valid values are any of the providers listed above
- This will override the default payment processor configuration
split_code
(Paystack only)
- When using Paystack, you can use this key to specify a split code to process the transaction as a Paystack Multi-split Transaction
- This feature is only available when using Paystack as the payment handler
Payment Conflict Resolution (PCR)
If for any reason, your user/customer claims that the payment they made was successful but that your platform did not reflect such successful payment, this PCR feature enables you to resolve such claims by simply calling:
/** * @var bool $outcome // --> true if payment was successful, false otherwise */ $outcome = LaravelMultipay::reQueryUnsuccessfulPayment($payment)
The payment will be re-resolved and the payment will be updated in the database. If the payment is successful, the SuccessfulLaravelMultipayPaymentEvent
event will be fired, so you can run any domain/application-specific procedures.
WebHooks Payment Notifications (optional)
One of the benefits of this package is to remove the need for you to have to deal with payment webhooks. Depending on your needs, the event handling may suffice for your use case.
If you need webhook notifications from payment providers, use the webhook endpoint provided by this package: route('payment.external-webhook-endpoint')
.
If you use this payment notification URL feature, ensure that in the handler for
SuccessfulLaravelMultipayPaymentEvent
, you have not previously handled the event for that same payment.
Events
SuccessfulLaravelMultipayPaymentEvent
If there are additional steps you want to take upon successful payment, listen for SuccessfulLaravelMultipayPaymentEvent
. This event will be fired whenever a successful payment occurs, with its corresponding Payment
model.
Testing
composer test
Credits
This package is made possible by the nice works done by the following awesome projects:
License
The MIT License (MIT). Please see License File for more information.