Payment gateway integrations for nafiswatsiq/subbase. Out-of-the-box support for popular gateways, public checkout pages, webhook handling, and payment events for subscription activation.
Quick links: Features · Requirements · Installation · Public Checkout · Events · Email Invoices · Configuration
- 💳 Multiple Gateway Drivers — Built-in support for PayPal, Stripe, Midtrans, Xendit, and Paddle.
- ⚙️ Custom Gateway Support — Extensible architecture to build your own payment driver.
- 🛒 Hosted Public Checkout — Modern, responsive checkout UI automatically connected with Subbase plan components.
- 🔔 Idempotent Webhooks — Secure, signature-verified webhook handling to update payment status safely.
- ⚡ Automated CLI Setup — Interactively install, configure, reset, or switch gateway drivers via
php artisan subbase-payment:install. - 📧 Email Invoices — Optional email receipt/invoice delivery upon verified payment completion.
- 🔄 Custom Redirect Flow — Easily redirect customers to named routes or external URLs after payment.
- PHP 8.2+
- Laravel 13.0+
- Filament 5.0
nafiswatsiq/subbase^1.3
composer require nafiswatsiq/subbase-paymentphp artisan vendor:publish --tag=subbase-payment-configphp artisan vendor:publish --tag=subbase-payment-migrationsRun the interactive installer to configure your driver:
php artisan subbase-payment:installOr pass the driver explicitly:
php artisan subbase-payment:install --driver=paypalpaypal— PayPal REST API Gatewaystripe— Stripe Checkout Sessions Gatewaymidtrans— Midtrans Snap Gateway (Indonesia)xendit— Xendit Invoice Gateway (SE Asia)paddle— Paddle Billing Gateway (v2 API)custom— Custom/Manual Gateway Driver
CI / Non-interactive setup:
php artisan subbase-payment:install --driver=paypal --no-interactionThe install command updates your .env file with SUBBASE_PAYMENT_DRIVER and the corresponding provider credentials.
php artisan migrateReset current driver configuration and clear driver env keys:
php artisan subbase-payment:resetReset and immediately switch to another driver:
php artisan subbase-payment:reset --driver=stripe --forceAuto-links from Subbase <x-subbase::plan-list /> component:
/checkout/{plan-slug}
Route name: subbase-payment.checkout
Customize path/middleware/redirects in config/subbase-payment.php:
'checkout' => [
'path' => 'checkout',
'middleware' => ['web'],
'return_url' => null, // named route or full URL after successful payment
'cancel_url' => null, // named route or full URL after canceled payment
],Page shows plan features, locale-aware price, collects name/email before payment.
Set return_url / cancel_url to override the default status page:
| Value | Behavior |
|---|---|
null (default) |
Show built-in status page (status.blade.php) |
Named route (e.g. dashboard) |
redirect()->route('dashboard', $plan->slug) |
Full URL (e.g. https://app.example/success) |
redirect()->away('https://app.example/success') |
Example — redirect to dashboard after payment:
'checkout' => [
'return_url' => 'dashboard',
'cancel_url' => 'plans.index',
],Example — external URLs:
'checkout' => [
'return_url' => 'https://app.example.com/payment/success',
'cancel_url' => 'https://app.example.com/payment/cancel',
],Webhook verifies payment → dispatches PaymentReceived event.
Handle in your app (e.g. AppServiceProvider):
use Nafiswatsiq\SubbasePayment\Events\PaymentReceived;
use Nafiswatsiq\Subbase\Models\Plan;
use Illuminate\Support\Facades\Event;
Event::listen(PaymentReceived::class, function (PaymentReceived $event) {
$payment = $event->paymentRecord;
$planId = $event->metadata['plan_id'] ?? null;
$user = \App\Models\User::where('email', $payment->customer_email)->first();
$plan = Plan::find($planId);
if ($user && $plan) {
$user->newSubscription('default', $plan);
}
});| Payment | Payment Driver | Driver Option | Guide |
|---|---|---|---|
| PayPal | paypal |
PayPal Setup Guide | |
| Stripe | stripe |
Stripe Setup Guide | |
| Midtrans | midtrans |
Midtrans Setup Guide | |
| Xendit | xendit |
Xendit Setup Guide | |
| Paddle | paddle |
Paddle Setup Guide | |
| ⚙️ | Custom | custom |
Custom Gateway Guide |
Published config/subbase-payment.php:
| Key | Default | Description |
|---|---|---|
driver |
null |
Selected gateway (paypal, stripe, midtrans, etc.) |
checkout.path |
checkout |
Public checkout URL prefix |
checkout.middleware |
['web'] |
Middleware on checkout routes |
checkout.return_url |
null |
Named route or full URL after successful payment |
checkout.cancel_url |
null |
Named route or full URL after canceled payment |
mail.send_invoice |
false |
Send email invoice to buyer on verified payment |
webhook.path |
subbase-payment/webhook |
Webhook endpoint path |
webhook.middleware |
[] |
Middleware on webhook (keep empty for PayPal) |
gateways |
[] |
Per-gateway config (see driver guides) |
Optional email invoice sending to customer upon verified payment. Disabled by default.
Add to your .env file:
SUBBASE_PAYMENT_SEND_INVOICE=trueOr update config/subbase-payment.php:
'mail' => [
'send_invoice' => true,
],The email view can be published and customized using:
php artisan vendor:publish --tag=subbase-payment-viewsLook for resources/views/vendor/subbase-payment/mail/invoice.blade.php.
Publish configuration file:
php artisan vendor:publish --tag=subbase-payment-configPublish Blade views (checkout.blade.php, status.blade.php to resources/views/vendor/subbase-payment):
php artisan vendor:publish --tag=subbase-payment-viewscomposer install
composer validate --strict
composer test- 📖 Documentation: GitHub Wiki
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
The MIT License (MIT). Please see License File for more information.





