nexuspay/payment-made-easy

A Laravel package for handling payments with multiple gateways (Paystack, Flutterwave, Stripe, Seerbit, etc.)

dev-master 2025-07-17 09:05 UTC

This package is auto-updated.

Last update: 2025-07-18 08:46:50 UTC


README

A comprehensive Laravel package for integrating multiple payment gateways with webhook support.

Supported Payment Gateways

  • Paystack - Nigerian payment gateway

Installation Instructions

1. Install via Composer

composer require nexuspay/payment-made-easy

2. Publish Configuration

php artisan vendor:publish --provider="NexusPay\PaymentMadeEasy\PaymentServiceProvider"

3. Environment Variables

Add the following to your .env file:

# Default Gateway
PAYMENT_GATEWAY=paystack
PAYMENT_CURRENCY=NGN

# Paystack
PAYSTACK_PUBLIC_KEY=your_paystack_public_key
PAYSTACK_SECRET_KEY=your_paystack_secret_key
PAYSTACK_CALLBACK_URL=https://yoursite.com/payment/callback

# Flutterwave
FLUTTERWAVE_PUBLIC_KEY=your_flutterwave_public_key
FLUTTERWAVE_SECRET_KEY=your_flutterwave_secret_key
FLUTTERWAVE_ENCRYPTION_KEY=your_flutterwave_encryption_key
FLUTTERWAVE_CALLBACK_URL=https://yoursite.com/payment/callback

# Stripe
STRIPE_PUBLIC_KEY=your_stripe_public_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
STRIPE_CALLBACK_URL=https://yoursite.com/payment/callback

4. Usage

The package is now ready to use! See the usage examples for implementation details.

Basic Usage

use NexusPay\PaymentMadeEasy\Facades\Payment;

// Initialize payment
$response = Payment::driver('paystack')->initializePayment([
    'email' => 'customer@example.com',
    'amount' => 1000, // Amount in kobo/cents
    'reference' => 'ORDER_123',
    'callback_url' => 'https://yoursite.com/payment/callback',
]);

// Verify payment
$verification = Payment::driver('paystack')->verifyPayment('ORDER_123');

// Process refund
$refund = Payment::driver('paystack')->refundPayment('ORDER_123', 500);

Webhook Support

The package includes comprehensive webhook support for all gateways:

// Webhook URLs are automatically registered:
// POST /webhooks/payment-gateways/{gateway}

// Example: https://yoursite.com/webhooks/payment-gateways/paystack

Advanced Features

  • Driver Pattern: Easy to extend with new payment gateways
  • Event System: Laravel events for payment notifications
  • Webhook Verification: Automatic signature verification
  • Exception Handling: Comprehensive error handling
  • Multi-Currency: Support for multiple currencies
  • Subscription Support: Recurring payment support where available

Testing

composer test

Contributing

Please see CONTRIBUTING.md for details.

Security

If you discover any security-related issues, please email babusunnah@gmail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.