Ask a side project which payment provider it uses and the answer is usually baked into the models, the controllers, the jobs and half the views. Switching from Stripe to Paddle - say you want a merchant of record to take sales tax and VAT off your plate - becomes a rewrite instead of a config change. That ossification is a choice, and it happens on day one, when the first Cashier::billable trait goes onto the User model and the provider's nouns leak into every corner of the app.

Here is the alternative the kit this series is drawn from ships: two providers, Paddle and Stripe, behind one small contract, with plans defined in config and every piece of billing state written by webhooks. No Cashier, no billing package at all.

The whole surface is five methods

Everything the application needs from a billing provider fits in one interface:

interface BillingProvider { public function name(): string; /** * A hosted checkout URL for the plan. The user's id is attached to * the checkout as metadata so webhooks can find their account. */ public function createCheckoutUrl(User $user, Plan $plan): string; /** * A hosted self-service portal URL, or null when the user has no * customer record with this provider yet. */ public function createPortalUrl(User $user): ?string; /** * Cancel at the end of the paid period. The subscription row is * updated when the provider's webhook arrives, not here. */ public function cancelSubscription(Subscription $subscription): void; /** * Verify the webhook signature and normalize the payload into a * BillingEvent. Throws BillingException on a bad signature. */ public function verifyWebhook(Request $request): BillingEvent; } 

The deliberate move is what is not here. There is no charge(), no refund(), no updateCard(), no syncSubscription(). Charges happen on hosted checkout pages, card updates happen in the hosted portal, refunds happen in the provider's dashboard. The application only ever asks two questions - "where do I send this user to pay or manage" and "what did the provider just tell me happened" - and everything it knows about billing arrives through the second one.

That smallness is the point. An interface with five methods has two cheap implementations; an interface with twenty has one real one and one that rotted.

Plans are config, not database rows

'plans' => [ 'pro' => [ 'name' => 'Pro', 'description' => 'For products with real users.', 'price_cents' => 4900, 'interval' => 'month', 'credits' => 10_000, 'features' => ['10,000 AI credits / month', 'Unlimited team members', 'Priority support'], 'paddle_price_id' => env('PADDLE_PRICE_PRO_MONTHLY'), 'stripe_price_id' => env('STRIPE_PRICE_PRO_MONTHLY'), ], // ... ], 

Plans are not data, they are marketing. They change when positioning changes, not when the business logic changes, so they live next to the rest of the positioning - in config, in git, in the diff of the pull request that changes the price. Each plan carries both providers' price IDs, and those come from env vars so the same code runs against Paddle sandbox locally and Stripe production live without an edit.

The Plan value object is final readonly and resolves from config:

final readonly class Plan { public function __construct( public string $key, public string $name, public int $priceCents, public string $interval, public int $credits, public array $features, public ?string $paddlePriceId, public ?string $stripePriceId, ) {} public static function all(): array { return collect(config('billing.plans')) ->map(fn (array $config, string $key) => self::fromConfig($key, $config)) ->all(); } } 

One consequence worth stating plainly: since plan definitions are config, a webhook can carry a price ID the app has never seen and the app must look the plan up from the provider's ID, not assume it knows the mapping. Plan::forPaddlePriceId() exists for exactly that, and an unknown price ID is an error to log, not a plan to invent.

Two providers, one manager, and the method that makes switching survivable

The manager resolves drivers lazily and has two entry points that look similar and mean different things:

class BillingManager { /** * The provider new checkouts go through (config billing.provider). */ public function provider(): BillingProvider { return $this->driver(config('billing.provider', 'paddle')); } /** * The provider a subscription actually lives on. Existing * subscriptions keep working after billing.provider changes. */ public function providerFor(Subscription $subscription): BillingProvider { return $this->driver($subscription->provider); } } 

provider() is where new business goes. providerFor() is where existing customers stay. The distinction is the whole migration story: you flip BILLING_PROVIDER=stripe, new checkouts go to Stripe from that request on, and every subscription created before the flip keeps getting its portal URLs, cancellations and webhook handling from Paddle, because the subscription row remembers who owns it. There is no cutover weekend and no data migration, just two providers running side by side until the old book of business churns out.

The subscription record storing its provider name is doing more work than any other column in the table.

Webhooks are the only writer

Checkout creation shows the pattern in miniature:

public function createCheckoutUrl(User $user, Plan $plan): string { $priceId = $plan->paddlePriceId ?? throw new BillingException("Plan [{$plan->key}] has no Paddle price id. Set it in your .env."); $response = Http::baseUrl($this->baseUrl()) ->withToken(config('billing.paddle.api_key')) ->post('/transactions', [ 'items' => [['price_id' => $priceId, 'quantity' => 1]], 'customer' => ['email' => $user->email], 'custom_data' => ['user_id' => $user->id], 'checkout' => ['url' => route('billing.return')], ]); // ... } 

The user's id rides to the provider as custom_data / metadata. Nothing is written locally when the checkout is created - no pending subscription row, no optimistic state. The user could close the tab, the card could decline, the checkout could expire, and the database neither knows nor cares. The first local write happens when the provider's webhook arrives, gets its signature verified, and becomes a normalized BillingEvent:

final readonly class BillingEvent { public function __construct( public string $type, // subscription_created|subscription_updated|... public string $provider, public ?int $userId, public ?string $customerId, public ?string $subscriptionId, public ?string $planKey, public ?string $status, public ?\DateTimeImmutable $currentPeriodEndsAt, public array $raw, public ?string $eventId = null, public ?\DateTimeImmutable $occurredAt = null, ) {} } 

Both drivers flatten their payloads into this one shape, so the handler downstream has never heard the words "Paddle" or "Stripe". The cancellation flow shows why that matters: cancelSubscription() returns void and changes nothing locally. It asks the provider to cancel at period end, and the subscription row moves to canceled when the webhook lands. If the cancel API call succeeds but the webhook never arrives, the local state stays stale until the provider retries and one lands - there is no optimistic local cancel to contradict it, and no scheduled reconciler in this codebase, so the provider's retry policy is the backstop. Because reads always come from webhook-written rows, there is exactly one state that can be stale, not two to reconcile.

The retry, dedupe and ordering side of this - idempotency keys on event IDs, credit grants keyed to invoice IDs - got its own article earlier in this series, "Idempotent Paddle and Stripe webhooks in Laravel", and the credit ledger that spends those grants got one too. This article is about the seam those pieces hang on.

What this deliberately does not do

  • No proration math. Upgrades and downgrades apply from the next billing boundary, in provider terms. Mid-cycle arithmetic is where billing code goes to be wrong in currencies you forgot you supported.
  • No per-seat pricing. Seats are unlimited on every plan; the metered resource is AI credits, and that metering is a separate ledger with its own rules.
  • No dunning UI. Failed payments are the provider's hosted flow to retry; the app just reflects the status webhooks report.
  • No client-side provider SDKs. No Stripe.js, no Paddle.js, no card elements. Hosted checkout or nothing, which keeps PCI scope at the floor.

Each of these is a feature someone will need eventually, and each is named here so adding it is a decision instead of an accident.

The rules

  • The app asks providers two questions: where to send a user, and what just happened. Everything else lives on hosted pages.
  • If a method would only ever be called by one provider's happy path, it does not belong in the contract.
  • Plans are config. Price IDs are env. Neither is a database row.
  • Subscriptions remember their provider; new business follows config. Never migrate rows to switch.
  • Webhooks are the only writer of billing state. Optimistic local writes are how two sources of truth are born.
  • Keep the interface small enough that the second implementation stays honest.

This article was generated by an AI assistant. The code above comes from a working Laravel 13 codebase and is covered by its feature tests, but walk the code before you trust it with real money - your provider credentials, tax situation and pricing model are your own.