Laravel Packages

PayZephyr: One Payment API for Stripe, Paystack, and PayPal

Published
PayZephyr: One Payment API for Stripe, Paystack, and PayPal image

PayZephyr is a Laravel payments package from Nwaneri Chukwunyere Kenneth that puts one fluent API in front of eight payment providers.

Here is what the package gives you:

  • Eight drivers — Paystack, Stripe, PayPal, Flutterwave, Square, Monnify, OPay, and Mollie behind the same Payment facade
  • Automatic failover — fall back to a configured provider when the default one fails.
  • Double-charge protection — prevent customers from paying twice
  • Signed webhooks — verify signatures and replay prevention
  • Subscriptions — define subscription plans on providers that support them
  • Refunds — full and partial payment refunds
  • And more...

Taking a Payment

Using this package, you get a Payment facade that you can use to take a payment by sending the customer to the provider's checkout page:

use KenDeNigerian\PayZephyr\Facades\Payment;

Route::get('/checkout', function (Order $order) {
    return Payment::amount(500.00)
        ->email($order->user->email)
        ->reference('order_'.$order->id)
        ->callback(route('payment.callback'))
        ->redirect();
});

The customer comes back to your callback route with a reference to verify:

Route::get('/payment/callback', function (Request $request) {
    $verification = Payment::verify($request->query('reference'));

    if ($verification->isSuccessful()) {
        // Mark the order paid.
    }
})->name('payment.callback');

Failovers

Using this package, you can define a default provider as well as a fallback if you want/need one:

PAYMENTS_DEFAULT_PROVIDER=paystack
PAYMENTS_FALLBACK_PROVIDER=stripe

Subscriptions and Refunds

PayZephyr also supports subscriptions using the planData method to create plans and later subscribe to them when a customer signs up:

$plan = Payment::subscription()
    ->planData(new SubscriptionPlanDTO(
        name: 'Pro Monthly',
        amount: 20.00,
        interval: 'monthly',
        currency: 'USD',
    ))
    ->with('stripe')
    ->createPlan();

Payment::subscription()
    ->customer($user->email)
    ->plan($plan->planCode)
    ->idempotency()
    ->with('stripe')
    ->subscribe();

Refunds are also supported, with partial refunds when you define an amount():

$refund = Payment::refund('txn_ref_123')
    ->amount(25.00)
    ->reason('customer requested partial refund')
    ->with('paystack')
    ->refund();

Check the documentation for details, including using $refund->isPending(), since some providers settle refunds later and notify you via a webhook rather than in the response.

Installation

You can install this package via Composer and run the provided install command. This package is geared towards use cases where you want the ability to accept

composer require kendenigerian/payzephyr
php artisan payzephyr:install

The source is on GitHub, and the documentation covers custom drivers, queue integration, and a production checklist. There is also a playground for trying the API without installing anything.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
UUID Request Input and Migration Failure Events in Laravel 13.42 image

UUID Request Input and Migration Failure Events in Laravel 13.42

Read article
Replay Missed Laravel Scheduled Tasks With Schedule Catchup image

Replay Missed Laravel Scheduled Tasks With Schedule Catchup

Read article
Search Polymorphic Relations and Filament Tables With Laravel Searchable image

Search Polymorphic Relations and Filament Tables With Laravel Searchable

Read article
Laravel Rest Api 3.0: Typed Fields, Metrics, and OpenAPI Docs image

Laravel Rest Api 3.0: Typed Fields, Metrics, and OpenAPI Docs

Read article
Real-Time Inertia Props With Laravel Reverb image

Real-Time Inertia Props With Laravel Reverb

Read article
PhpStorm 2026.3 Adds an Agent Workspace and PHP 8.6 Support image

PhpStorm 2026.3 Adds an Agent Workspace and PHP 8.6 Support

Read article