Once a subscription exists in your database, Laravel Polar gives you a rich set of methods to inspect its state, change the plan, handle cancellation, and query across all subscriptions. All state-changing methods call the Polar API and immediately sync the updated status back to your localDocumentation Index
Fetch the complete documentation index at: https://danestvesllc-2b77d201.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Subscription record — your database is always consistent.
Checking subscription status
valid()
Returns true if the subscription is active, on trial, past due, or within its grace period. This is the broadest “is the subscription usable?” check:
subscribed()
A convenience wrapper on the billable model. Equivalent to calling subscription()->valid() without loading the model first:
cancelled()
Returns true when Polar has marked the subscription as canceled (status canceled):
onGracePeriod()
A canceled subscription may still have time remaining in the current billing period. onGracePeriod() returns true when the subscription is canceled but ends_at is still in the future:
pastDue()
Returns true when a recurring payment has failed and the subscription is awaiting retry:
valid(). Polar retries failed payments automatically.
Checking the subscribed product
To verify the subscription is currently on a specific product, usehasProduct():
subscribedToProduct():
Swapping plans
When a customer wants to upgrade, downgrade, or change billing cadence, callswap() with the new product ID. The change takes effect at the next billing cycle and uses proration by default:
swapAndInvoice():
swap() prorates the change at the next billing cycle by default. swapAndInvoice() prorates and invoices immediately, charging any difference right away.Cancelling a subscription
Callcancel() to schedule a subscription for cancellation at the end of the current billing period:
cancel(), the subscription enters a grace period: the ends_at column is updated to the end of the current period, and the status becomes canceled. The customer retains access until ends_at passes.
Resuming a subscription
If a customer changes their mind during the grace period, callresume() to reinstate the subscription:
Applying and removing discounts
Apply a discount to a subscription so it takes effect on the next billing cycle:Querying subscriptions with scopes
TheSubscription model ships with Eloquent query scopes for each status. Use them to filter subscriptions across your entire database or scoped to a specific billable.