Subscriptions are the core of recurring billing in Laravel Polar. TheDocumentation 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.
Billable trait gives your model a subscribe() method that redirects a customer to a Polar-hosted checkout. Once payment is complete, the incoming SubscriptionCreated webhook automatically creates and links a Subscription record in your database — no manual wiring needed.
Starting a subscription
Pass a product ID tosubscribe() to begin a checkout session. Laravel Polar attaches the necessary metadata to the checkout automatically so the incoming webhook can associate the subscription with the correct user.
subscribe() creates a new checkout session on every call. If you call it frequently, cache the returned URL to avoid unnecessary API requests.Multiple subscription types
A single user can hold more than one active subscription — for example, a “swimming” plan and a “gym” plan at the same time. Pass a subscription type as the second argument tosubscribe() to distinguish them:
'default'.
How the webhook connects the subscription
After a successful checkout, Polar sends asubscription.created event to your webhook endpoint. Laravel Polar handles this automatically by dispatching a SubscriptionCreated event and creating a Subscription record in your database, linked to the billable model.
Customer completes checkout
The customer fills in payment details and confirms the subscription on the Polar-hosted checkout page.
Laravel Polar writes the subscription
The package verifies the signature and creates or updates the subscription record in your database.
Retrieving a subscription
Once a subscription has been created via the webhook, you can retrieve it from your billable model:subscription() returns the first Subscription model matching the given type, or null if none exists. Results are ordered by creation date, most recent first.
Checking subscription status
Usesubscribed() to confirm that a user has an active, valid subscription:
subscribed() returns true when the underlying subscription’s valid() check passes, meaning the subscription is active, on trial, past due, or within its grace period after cancellation.
Checking subscription to a specific product
To verify that a user is subscribed and that the subscription is currently on a specific product, usesubscribedToProduct():