Payment Gateway Integration Package
Open-source Laravel package for Tap Payments API integration. Provides a fluent interface for charge creation, two-step authorizations (hold & capture), invoicing, and recurring subscriptions. Supports 12+ regional payment methods across the MENA region. Features a Billable trait for direct model integration ($user->charge()), 6 domain events for payment lifecycle tracking, and HMAC-SHA256 webhook security. Built with developer experience in mind, offering type-safe parameters, idempotency protection, and a chainable builder pattern.
Major features and technical achievements of this project.
Chainable interface for charge construction
Support for 12+ MENA-specific payment options
Secure event handling with signature validation
Trait-based payment integration for Eloquent models
Hold and capture payment flows
Recurring billing and invoice management
The architectural patterns and design decisions behind this project.
Method chaining enables readable, self-documenting payment code. Each setter returns the builder instance, culminating in create() which validates and executes.
Multi-layer webhook protection with HMAC-SHA256 signatures, timestamp validation, and timing-safe comparison to prevent replay attacks.
Destinations value objects define payment splits. Supports percentage-based or fixed-amount distribution across multiple merchant accounts.
The Billable trait enables direct payment operations on Eloquent models. Implements BillableContract for type safety and IDE support.
Authorization flow allows holding funds before capture. Supports auto-capture timing, manual void, and idempotency protection.
Comprehensive event dispatching for payment lifecycle. Covers successful payments, failures, and webhook processing states.
Fluent Interface
Chainable method calls for constructing payment requests. Each method returns $this, enabling readable sequential configuration before final create() execution.
Laravel Facade + Service Container
Tap facade provides simplified static access to underlying services. Service container manages dependency injection and singleton instances.
Immutable Data Carriers
Readonly classes like Destination encapsulate domain concepts with built-in validation. Implement Laravel Arrayable for seamless serialization.
Abstract Service Base
AbstractService defines the skeleton for API operations. Concrete services override endpoint, resource class, and list key methods.
Billable Model Integration
Billable trait integrates payment capabilities directly into Eloquent models. Enables $user->charge() without facades. Implements BillableContract for IDE autocompletion and type safety.