Skip to content

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

PayZephyr is a Laravel package that wraps eight payment providers—Stripe, Paystack, PayPal, Flutterwave, and more—behind a single fluent Payment facade, with built-in failover, double-charge protection, subscriptions, and refunds.

Published · Updated · 3 min read

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

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

Managing multiple payment gateways in a Laravel application usually means juggling separate SDKs, inconsistent response shapes, and duplicated integration logic. PayZephyr, a package by Nwaneri Chukwunyere Kenneth, solves this by placing eight payment providers behind a single, fluent Payment facade.

Supported Providers

Out of the box, PayZephyr ships drivers for:

  • Paystack
  • Stripe
  • PayPal
  • Flutterwave
  • Square
  • Monnify
  • OPay
  • Mollie

All eight providers share the same API surface, so switching or adding a provider requires minimal code changes.

Taking a Payment

Initiating a checkout is straightforward. Chain the amount, customer email, a unique reference, and a callback URL onto the Payment facade, then call redirect():

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();
});

When the customer returns, verify the transaction reference on your callback route:

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

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

Automatic Failover

PayZephyr supports a primary and a fallback provider configured via environment variables. If the default provider fails, the package automatically retries with the fallback:

PAYMENTS_DEFAULT_PROVIDER=paystack
PAYMENTS_FALLBACK_PROVIDER=stripe

This is particularly useful for applications serving markets where provider availability can vary.

Subscriptions

For SaaS products, PayZephyr exposes a subscription API. Create a plan with planData() and a SubscriptionPlanDTO, then subscribe a customer to it:

$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();

Subscription support depends on the underlying provider's capabilities.

Refunds

Full and partial refunds are supported. Pass an amount() for a partial refund, or omit it for a full refund:

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

Because some providers settle refunds asynchronously, check $refund->isPending() and handle the final status via a signed webhook.

Additional Features

  • Double-charge protection — prevents a customer from being billed twice for the same transaction
  • Signed webhooks — signature verification and replay prevention built in
  • Custom drivers — extend the package with your own provider implementation
  • Queue integration — documented in the official docs for async payment flows

Installation

Install via Composer and run the provided Artisan command:

composer require kendenigerian/payzephyr
php artisan payzephyr:install

The official documentation covers custom drivers, queue integration, and a production checklist. A playground is also available for testing the API without a local install.

Key Takeaways

  • One Payment facade covers eight providers: Paystack, Stripe, PayPal, Flutterwave, Square, Monnify, OPay, and Mollie
  • Automatic failover is configured with two environment variables
  • Subscriptions, full refunds, and partial refunds are first-class features
  • Double-charge protection and signed webhook verification are built in
  • A playground lets you explore the API before installing anything

Source: PayZephyr: One Payment API for Stripe, Paystack, and PayPal — Laravel News

Frequently asked questions

Which payment providers does PayZephyr support?

PayZephyr ships with eight built-in drivers: Paystack, Stripe, PayPal, Flutterwave, Square, Monnify, OPay, and Mollie. All share the same fluent API surface.

How does PayZephyr handle payment provider failover?

You set PAYMENTS_DEFAULT_PROVIDER and PAYMENTS_FALLBACK_PROVIDER in your .env file. If the default provider fails, PayZephyr automatically retries the transaction with the configured fallback provider.

Does PayZephyr support partial refunds?

Yes. Call Payment::refund() with an amount() value for a partial refund, or omit it for a full refund. Because some providers process refunds asynchronously, you can check $refund->isPending() and handle the final status via a signed webhook.

Mohamed Said

About the author

Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

About GitHub LinkedIn WhatsApp Email Address My CV

Have a technical challenge?

Tell me what you’re building. I reply within two working days.

Discuss your project