The Laravel Polar package seamlessly integrates your Laravel application with Polar.sh, a modern way to sell your SaaS and digital products. This package can handle subscriptions, recurring payments, and interact with Polar's API:
use Danestves\LaravelPolar\Billable; class User extends Authenticatable{ use Billable;} // Redirect to a Polar subscription URLRoute::get('/subscribe', function (Request $request) { return $request->user()->checkout(['product_id_123']);}); // Customer portalRoute::get('/customer-portal', function (Request $request) { return $request->user()->redirectToCustomerPortal();});
After payment is completed, the incoming webhook handler connects the payment to your billable model in the database.
$user->subscribed();$user->subscription()->valid();$user->subscription()->hasProduct('product_id_123');$user->subscription()->cancelled();$user->subscription()->onGracePeriod();$user->subscription()->pastDue(); // Swap plans$user->subscription()->swap('product_id_123');$user->subscription()->swapAndInvoice('product_id_123');$user->subscription()->resume();// ...
Main Features
- Integration with Polar.sh – Easily manage subscriptions and payments within Laravel.
- Subscription Management – Supports handling subscription plans and user subscriptions.
- Webhook Handling – Processes events from Polar.sh, such as payment updates.
- Preconfigured Migrations – Includes database migrations for subscription-related tables.
- Routes & Controllers – Provides built-in endpoints for managing subscriptions.
- Customizable Views – Offers default UI components that can be modified as needed.
- Configuration Options – Allows developers to fine-tune the integration settings.
Learn More
You can learn more about this package, get full installation instructions, and view the source code on GitHub. The Polar documentation can help you get started with the Polar billing platform.