Subscribd is gateway-agnostic — you choose which payment provider handles your billing by setting a single environment variable. The package resolves the correct driver automatically, so the rest of your application code stays the same regardless of which gateway you use.
Set the default gateway
Set SUBSCRIBD_GATEWAY in your .env file to stripe, paypal, or braintree. Then add the credentials for your chosen provider.
SUBSCRIBD_GATEWAY=stripe
STRIPE_SECRET=sk_live_...
STRIPE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
Register this webhook endpoint in your Stripe dashboard:https://your-app.com/subscribd/webhook/stripe
SUBSCRIBD_GATEWAY=paypal
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_WEBHOOK_ID=...
PAYPAL_MODE=live
Register this webhook endpoint in your PayPal developer dashboard:https://your-app.com/subscribd/webhook/paypal
Braintree requires its own SDK. Install it before configuring credentials:composer require braintree/braintree_php
SUBSCRIBD_GATEWAY=braintree
BRAINTREE_ENV=production
BRAINTREE_MERCHANT_ID=...
BRAINTREE_PUBLIC_KEY=...
BRAINTREE_PRIVATE_KEY=...
Register this webhook endpoint in your Braintree control panel:https://your-app.com/subscribd/webhook/braintree
All webhook endpoints are registered automatically by Subscribd’s service provider. You do not need to add them to your routes/web.php.
Switch gateways at runtime
You can override the default gateway for a single operation by chaining .on() before any billing call:
// Use PayPal for this subscription only
Subscribd::for($user)->on('paypal')->subscribe('starter');
// Access a gateway driver directly
Subscribd::gateway('stripe')->createCustomer($user);
This is useful when different customer segments use different payment providers, or when migrating between gateways incrementally.
Register a custom gateway
If you need to integrate a payment provider that Subscribd does not ship with, implement the BillingGateway interface (16 methods) and register your driver via GatewayManager::extend():
use Pixelworxio\Subscribd\Contracts\GatewayManager;
app(GatewayManager::class)->extend('my-provider', function ($app) {
return new MyProviderGateway($app['config']->get('services.my_provider'));
});
Call extend() in the boot() method of a service provider. Once registered, you can set SUBSCRIBD_GATEWAY=my-provider in .env or target the driver with ->on('my-provider').
A custom gateway just needs to implement the 16 methods on the BillingGateway interface. Once registered, you can target it the same way as Stripe, PayPal, or Braintree — via SUBSCRIBD_GATEWAY or the .on() per-call override.