Subscribd facade is your primary entry point for all billing operations. Calling Subscribd::for($billable) returns a BillableContext instance scoped to that billable model. Every method on BillableContext — subscribe, swap, cancel, resume, charge — delegates to the corresponding action class, so you get consistent event firing, gateway abstraction, and error handling without wiring anything manually.
BillableContext methods
subscribe()
Creates a new subscription for the billable on the configured gateway.name defaults to 'default' when omitted. A single billable can hold multiple independent subscriptions, each identified by its name.swap()
Upgrades or downgrades the plan on an existing subscription.cancel()
Cancels a subscription. By default cancellation takes effect at the end of the current billing period, leaving a grace period during whichonGracePeriod() returns true.
resume()
Resumes a subscription that is in the grace period or in a paused state.charge()
Issues a one-off charge to the billable outside of a recurring subscription.applyCoupon()
Applies a coupon code directly from the context without needing to resolve theCoupon model yourself.
Per-call gateway override with ->on()
You can override the configured gateway for a single operation by chaining->on('gateway-name') before any action method. This is useful when a user has payment methods on multiple gateways or when migrating between providers.
The
->on() method returns the same BillableContext instance, so the full method chain remains available. The override applies only to the next action call — it does not change the global default.Direct gateway access with Subscribd::gateway()
When you need to call a gateway method that has no facade shortcut — for example, creating a customer record manually or registering a custom driver — useSubscribd::gateway() to get the driver instance directly.
Complete BillableContext reference
| Method | Description |
|---|---|
subscribe(string $plan, array $options = []) | Create a new subscription |
subscribeTo(string $plan, array $options = []) | Alias for subscribe() |
swap(string $name, string $newPlan, array $options = []) | Upgrade or downgrade a named subscription |
swapTo(string $newPlan, string $name = 'default', array $options = []) | Swap with argument order flipped |
cancel(string $name = 'default', bool $immediately = false) | Cancel at period end or immediately |
cancelSubscription(string $name = 'default', bool $immediately = false) | Alias for cancel() |
resume(string $name = 'default') | Resume a paused or grace-period subscription |
resumeSubscription(string $name = 'default') | Alias for resume() |
charge(Money $amount) | Issue a one-off charge |
chargeOnce(Money $amount) | Alias for charge() |
applyCoupon(string $code) | Apply a coupon by code |
on(string $gateway) | Override the gateway for the next operation |