Download the PHP package mostafax/payment-engine without Composer
On this page you can find all versions of the php package mostafax/payment-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mostafax/payment-engine
More information about mostafax/payment-engine
Files in mostafax/payment-engine
Package payment-engine
Short Description Enterprise Payment Orchestration, Reconciliation, Recovery and Monitoring Platform for Laravel — Multi-gateway (KNET, MyFatoorah, Tap, PayTabs, Stripe, PayPal, Fawry), Transaction Ledger, Webhook Reliability, Auto-Recovery, Backfill Engine
License MIT
Homepage https://github.com/mostafax2/payment-engine
Informations about the package payment-engine
mostafax/payment-engine
Enterprise Payment Orchestration, Reconciliation, Recovery & Monitoring Platform for Laravel
Overview
mostafax/payment-engine transforms any Laravel application into a full payment orchestration platform. It provides a unified driver interface across 7 payment gateways, an immutable transaction ledger, a webhook reliability layer with Dead Letter Queue, automated reconciliation, stale-transaction recovery, and historical backfill — all event-driven and multi-tenant ready.
Author: Mostafa Elbayyar
Documentation: https://mostafax2.github.io/payment-engine/
Support: [email protected]
Supported Gateways
| Gateway | Region | Status |
|---|---|---|
| KNET | Kuwait/Gulf | ✅ Full Support |
| MyFatoorah | Gulf & MENA | ✅ Full Support |
| Tap Payments | MENA | ✅ Full Support |
| PayTabs | MENA/Global | ✅ Full Support |
| Stripe | Global | ✅ Full Support |
| PayPal | Global | ✅ Full Support |
| Fawry | Egypt / MENA | ✅ Full Support |
Key Features
- Multi-Gateway Driver Architecture — Strategy Pattern. Add new gateways by implementing
PaymentDriverInterface. - Immutable Transaction Ledger — ULID-keyed
pe_transactions+ append-onlype_transaction_eventsaudit trail. - Webhook Reliability Layer — Raw payload persistence, SHA-256 idempotency, exponential backoff (1m→5m→15m→1h→24h), Dead Letter Queue.
- Reconciliation Engine — Automated comparison of gateway vs internal records with mismatch detection (amount tolerance: ±0.01).
- Auto-Recovery Engine — Scans stale pending transactions and self-heals via gateway inquiry.
- Historical Backfill Engine — Full or gap-only sync from gateway for any date range.
- 6 Domain Events — Decoupled lifecycle:
PaymentInitiated,PaymentCaptured,PaymentFailed,PaymentRefunded,PaymentRecovered,PaymentReconciled. - Multi-Tenant Support —
tenant_idscoping via configurable resolver callable. - 3 Artisan Commands —
payment:sync,payment:reconcile,payment:recover. - REST API — 10 Sanctum-protected endpoints.
Requirements
- PHP 8.2+
- Laravel 10, 11, or 13
- MySQL 8+ or MariaDB 10.3+
- Redis (recommended for queue workers)
Installation
Option A — One Command (Recommended)
payment:install automatically:
- Publishes
config/payment-engine.php - Runs the 6 database migrations
- Patches CSRF exclusions in
VerifyCsrfToken.php(Laravel 10) orbootstrap/app.php(Laravel 11+) - Appends
.envstubs for gateway credentials
Option B — Manual
Configure .env
4. Exclude Callbacks from CSRF
5. Start Queue Workers
Basic Usage
Initiate a Payment
Listen to Events
Live Gateway Inquiry
Reconciliation
Historical Backfill
API Endpoints
All endpoints require Authorization: Bearer {token} (Laravel Sanctum) except webhook receivers.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/payment/initiate |
Initiate payment, get redirect URL |
GET |
/api/payment/transactions |
Paginated list (filter by gateway/status/date) |
GET |
/api/payment/transactions/{ulid} |
Transaction + full audit trail |
POST |
/api/payment/inquire/{trackId} |
Live gateway status check |
POST |
/api/payment/reconcile |
Trigger reconciliation |
GET |
/api/payment/reconciliation/reports |
Paginated reports |
GET |
/api/payment/reconciliation/reports/{ulid} |
Report with mismatch items |
POST |
/api/payment/webhook/{gateway} |
Receive push webhooks (no auth, sig verified) |
ANY |
/payment/{gateway}/success |
KNET/PayTabs success callback |
ANY |
/payment/{gateway}/error |
KNET/PayTabs error callback |
Database Tables
| Table | Purpose |
|---|---|
pe_transactions |
Central payment ledger (ULID, multi-tenant, status lifecycle) |
pe_transaction_events |
Append-only audit trail for every status change |
pe_webhook_payloads |
Raw payload persistence + retry state |
pe_webhook_attempts |
Per-attempt log with exception trace |
pe_reconciliation_reports |
Reconciliation run summaries |
pe_reconciliation_items |
Individual mismatch records per report |
Table names are configurable via config('payment-engine.tables.*').
Custom Gateway Driver
Implement PaymentDriverInterface to add any gateway:
Register it in your ServiceProvider:
Upgrade from 1.x (KNET-only)
- Update
composer.json:"mostafax/payment-engine": "^2.0" - Publish and run new migrations:
php artisan vendor:publish --tag=payment-engine-migrations && php artisan migrate - Publish new config:
php artisan vendor:publish --tag=payment-engine-config - Replace
.envkeys with newKNET_*prefixed names (see Installation above) - Replace old CSRF exclusion
knet/*withpayment/*/success,payment/*/error - Update namespace:
Mostafax\Knet\*→Mostafax\PaymentEngine\*
Changelog
See CHANGELOG.md for full release history.
License
MIT — see LICENSE for details.
Author
Mostafa Elbayyar
Senior Software Engineer & Laravel Package Author
GitHub: @mostafax2
Email: [email protected]
All versions of payment-engine with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/queue Version ^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^10.0|^11.0|^12.0|^13.0
illuminate/bus Version ^10.0|^11.0|^12.0|^13.0
illuminate/cache Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/notifications Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.5