Download the PHP package digitaldev-lx/laravel-eupago without Composer
On this page you can find all versions of the php package digitaldev-lx/laravel-eupago. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download digitaldev-lx/laravel-eupago
More information about digitaldev-lx/laravel-eupago
Files in digitaldev-lx/laravel-eupago
Package laravel-eupago
Short Description A Laravel package for making payments through the EuPago API.
License MIT
Informations about the package laravel-eupago
Laravel EuPago
A comprehensive Laravel package for integrating with the EuPago payment gateway API. Support for Multibanco, MB Way, Credit Card, Google Pay, Apple Pay, and Payouts management.
Requirements
| Release | PHP | Laravel |
|---|---|---|
| 3.0.0 | >= 8.4 | 11 || 12 || 13 |
| 2.3.0 | 8.3, 8.4 | 11 || 12 |
| 2.2.0 | >= 8.3 | 11 |
| 2.1.0 | >= 8.1 | 10 |
Installation
Publish the migration
Run the migration
Publish the configuration file (optional)
Publish the translations files (optional)
Configuration
Environment Variables
Add the following to your .env file:
There are two environments available: "test" and "prod". Use the "test" environment during development and switch to "prod" when your application is ready for production.
Callback Security
The callback endpoint (GET /eupago/callback) is the trust boundary that confirms payments, so it is hardened as follows:
- API key authentication — the
chave_apiparameter is compared againstEUPAGO_API_KEYin constant time (hash_equals). Invalid callbacks are rejected with an HTTP422and never reveal which field failed. - No secret leakage — the API key is never logged (only a redacted summary is, when
EUPAGO_LOG_CALLBACKS=true) and is stripped from theCallbackReceivedevent payload. - Atomic confirmation — payments are confirmed inside a locked transaction, so concurrent callbacks for the same reference cannot fire the "paid" event twice.
- Rate limiting — the route is throttled to 60 requests/minute per IP.
- Optional IP allowlist — set
EUPAGO_ALLOWED_IPSto the EuPago callback source IPs to reject any other origin. Leave it empty to accept all (default).
Payment Methods
Multibanco (MB) References
Usage
Response format:
Using the Trait
Callback
The package handles callbacks automatically, updating the payment state and triggering events.
Endpoint: GET /eupago/callback
Payment Method Code: PC:PT
MB Way References
Usage
Using the Trait
Callback
Endpoint: GET /eupago/callback
Payment Method Code: MW:PT
Credit Card
Single Payment
Maximum: €3,999 per transaction
Callback Code: CC:PT
Recurring Payments (Subscriptions)
Step 1: Create Authorization
Step 2: Execute Recurring Payment
Using the Trait
Google Pay
Maximum: €99,999 per transaction
Callback Code: GP:PT
Using the Trait
Apple Pay
Callback Code: AP:PT
Using the Trait
Payouts Management
List Payouts
Retrieve all payouts for a specific date range using OAuth Bearer Token authentication.
List Payout Transactions
Retrieve all transaction details within a date range.
Note: For single-day queries, use the same date for both start_date and end_date.
Callback Parameters
All payment callbacks receive the following parameters:
| Name | Type | Description |
|---|---|---|
| valor | float | Payment amount |
| canal | string | Channel identifier |
| referencia | string | Payment reference |
| transacao | string | Transaction ID |
| identificador | integer | External identifier |
| mp | string | Payment method code |
| chave_api | string | API key |
| data | date:Y-m-d H:i:s | Transaction date |
| entidade | string | Entity code |
| comissao | float | Commission |
| local | string | Transaction location |
Events
The package dispatches events throughout the payment lifecycle.
Reference Creation Events
MBReferenceCreated/MBReferenceCreationFailedMBWayReferenceCreated/MBWayReferenceCreationFailedCreditCardReferenceCreated/CreditCardReferenceCreationFailedCreditCardRecurrenceAuthorizationCreated/CreditCardRecurrenceAuthorizationCreationFailedCreditCardRecurringPaymentCreated/CreditCardRecurringPaymentCreationFailedGooglePayReferenceCreated/GooglePayReferenceCreationFailedApplePayReferenceCreated/ApplePayReferenceCreationFailed
Payment Events
MBReferencePaidMBWayReferencePaidCreditCardReferencePaidGooglePayReferencePaidApplePayReferencePaid
Expiration Events
MBReferenceExpiredMBWayReferenceExpired
Callback Events
CallbackReceived- Dispatched for every valid callback. The payload excludes the API key and channel.InvalidCallbackReceived- Dispatched when a callback fails validation (wrong API key/channel, unknown payment method, malformed data). Carries the validationerrorsand a redactedcallbackData(the API key and channel are excluded).
Invalid callbacks are rejected with a generic HTTP 422 response (no field-level detail), while listeners can still inspect the failure through InvalidCallbackReceived.
Listening to Events
Auto-discovery (recommended):
Create a listener class in app/Listeners/ — Laravel automatically discovers it via the type-hinted handle() method:
No manual registration needed. Laravel scans app/Listeners/ automatically.
Manual registration:
Register listeners in your app/Providers/AppServiceProvider.php:
Closure listeners:
Commands
Check Expired References
Check for expired payment references and dispatch expiration events:
This command finds all MB references where end_date has passed and state is 0 (unpaid), then dispatches MBReferenceExpired event for each.
Scheduling:
Laravel 11 & 12:
Add to your routes/console.php:
Laravel 10:
Add to your app/Console/Kernel.php:
Testing
The package includes comprehensive test coverage using Pest PHP.
Running Tests
Code Style
Static Analysis
Using Factories in Tests
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Changelog
Please see CHANGELOG.md for details on recent changes.
License
digitaldev-lx/laravel-eupago is open-sourced software licensed under the MIT license.
About DigitalDev
DigitalDev is a digital transformation agency based in Lisbon, Portugal. We specialize in transforming ideas into digital solutions that drive business growth online.
With expertise in custom web development, system integration, DevOps, AI implementation, and advanced search systems, we help businesses scale beyond generic templates with practical, data-driven solutions. Our tech stack includes Laravel, Livewire, React, and modern cloud infrastructure.
Contact: [email protected] | +351 961 546 227