Download the PHP package kodemeric/payment-gateways without Composer
On this page you can find all versions of the php package kodemeric/payment-gateways. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kodemeric/payment-gateways
More information about kodemeric/payment-gateways
Files in kodemeric/payment-gateways
Package payment-gateways
Short Description A Laravel package for integrating multiple payment gateways (Paystack, Flutterwave, Monnify, and more)
License MIT
Homepage https://github.com/olotudammy/payment-gateways
Informations about the package payment-gateways
Payment Gateways
A Laravel package for integrating multiple payment gateways with a clean, extensible interface. Supports Paystack, Flutterwave, Monnify, Stripe.
Features
- ๐ Support for multiple payment gateways (Paystack, Flutterwave, Monnify, Stripe, PayPal)
- ๐ Coming soon: Pesapal, Interswitch, PayFast
- ๐ Country-agnostic - add any payment gateway from any country
- ๐ Easy to extend with new gateways (programming to an interface)
- ๐ Transaction tracking and logging
- ๐ Webhook support for all gateways
- โ Transaction verification
- ๐งช Comprehensive test coverage
Installation
Quick Install
Run the install command to set up everything at once:
This command will:
- Publish the configuration file
- Publish the migrations
- Optionally run the migrations
Manual Installation
If you prefer to install manually:
1. Publish configuration and migrations:
Or publish individually:
2. Run migrations:
Or use the standard Laravel command:
Configuration
After publishing, configure your gateway credentials in config/payment-gateways.php:
Usage
Basic Usage
Initiate Transaction
The package uses DTOs (Data Transfer Objects) for type safety and better structure:
Verify Transaction
Webhooks
Webhook routes are automatically registered:
/webhooks/paystack/webhooks/flutterwave/webhooks/monnify/webhooks/stripe/webhooks/paypal
Configure these URLs in your gateway dashboards.
Using Dependency Injection
Models
Transaction
TransactionLog
DTOs (Data Transfer Objects)
The package uses DTOs for type safety and better structure. All DTOs have fromArray() and toArray() methods for easy conversion.
InitiateTransactionRequest
The request DTO used to initiate a payment transaction with any gateway.
Properties:
amount(float, required) - The payment amount in the base currency (e.g., 1000.00)email(string, required) - Customer's email addressreference(string, optional) - Unique transaction reference. If not provided, the gateway will auto-generate onecallbackUrl(string, optional) - URL to redirect after payment completion. Defaults to config valueredirectUrl(string, optional) - Alternative redirect URL (used by some gateways)currency(string, optional) - Currency code (ISO 4217). Defaults to 'NGN'customerName(string, optional) - Customer's full namedescription(string, optional) - Transaction descriptionmetadata(array, optional) - Additional metadata to attach to the transaction (e.g.,['order_id' => 123])userId(int, optional) - ID of the user making the transaction (for tracking purposes)
Example:
InitiateTransactionResponse
The response DTO returned after initiating a payment transaction.
Properties:
success(bool) - Whether the transaction initiation was successfulpaymentUrl(string|null) - The payment URL to redirect the customer to (null on failure)reference(string|null) - The transaction reference (gateway-generated or the one you provided)accessCode(string|null) - Gateway-specific access code (e.g., used by Paystack)transactionReference(string|null) - Gateway's internal transaction reference (may differ from reference)message(string|null) - Error message (only present whensuccessis false)gatewayResponse(array) - Raw response data from the gateway API
Success Response Example:
Failure Response Example:
VerifyTransactionResponse
The response DTO returned when verifying a transaction status.
Properties:
success(bool) - Whether the verification request was successfulreference(string|null) - The transaction reference that was verifiedstatus(string|null) - Transaction status: 'success', 'pending', or 'failed'amount(float|null) - The transaction amount that was paidcurrency(string|null) - The currency code (ISO 4217)message(string|null) - Error message (only present whensuccessis false)gatewayResponse(array) - Raw response data from the gateway API
Example:
WebhookPayload
The DTO that represents incoming webhook data from payment gateways. Automatically parsed from the raw request.
Properties:
data(array) - The main webhook payload data (varies by gateway)event(string|null) - Event type identifier (e.g., 'charge.success', 'charge.completed')eventType(string|null) - Alternative event type field (used by some gateways like Monnify)
Methods:
getReference()- Extracts the transaction reference from the payload, handling different gateway formats automatically
Example:
Gateway-Specific Formats:
The WebhookPayload automatically handles different webhook formats:
- Paystack:
{ event: 'charge.success', data: {...} } - Flutterwave:
{ event: 'charge.completed', data: {...} } - Monnify:
{ eventType: 'SUCCESSFUL_TRANSACTION', eventData: {...} } - Stripe:
{ type: 'checkout.session.completed', data: { object: {...} } } - PayPal:
{ event_type: 'PAYMENT.CAPTURE.COMPLETED', resource: {...} }
WebhookResponse
The response DTO returned after processing a webhook.
Properties:
success(bool) - Whether the webhook was processed successfullyevent(string|null) - The webhook event type that was processedreference(string|null) - The transaction reference from the webhookstatus(string|null) - The transaction status after processing ('success', 'pending', 'failed')message(string|null) - Error message (only present whensuccessis false)data(array) - Additional data from the webhook processing
Example:
Success Response:
Failure Response:
Artisan Commands
The package includes several helpful Artisan commands:
Install Command
Install the package (publishes config, migrations, and optionally runs migrations):
Publish Command
Publish all package resources (config and migrations):
Use --force to overwrite existing files:
Migrate Command
Run the package migrations:
Use --force to run in production:
Testing
First, install dependencies:
Then run the tests:
Requirements
- PHP 8.1+ (tested on 8.1, 8.2, 8.3)
- Laravel 10.x, 11.x, or 12.x
License
MIT
All versions of payment-gateways with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.9