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 exposes a small set of customer-management helpers that let you send users to Polar’s hosted customer portal and interact with their stored payment methods — all without exposing your org-scoped admin token to the client.
Both portal redirects and payment method operations mint a short-lived customer session token server-side on every call, so your admin credentials are never sent to the browser.
Polar customer portal is a Polar-hosted page where customers can update their info, manage subscriptions, download invoices, and add payment methods. You link to it; Polar hosts it.
Customer portal
Polar’s customer portal is a hosted, self-service page where your customers can update their personal information, manage subscriptions, and add new payment methods.Redirecting to the portal
CallredirectToCustomerPortal() from a controller or route closure. It returns a RedirectResponse pointing to the portal URL.
Getting the portal URL directly
If you need the URL without issuing an immediate redirect — for example to pass it to a view — usecustomerPortalUrl():
redirectToCustomerPortal() uses internally. Both methods mint a short-lived customer session each time they are called, so the resulting URL is always fresh.
Payment methods
Listing saved payment methods
CallpaymentMethods() on your billable to retrieve a Collection of the customer’s stored cards and generic payment instruments.
type property on each item acts as a discriminator. When type is 'card', the item is a PaymentMethodCard and exposes the following properties:
| Property | Type | Description |
|---|---|---|
brand | string | Card network, e.g. "visa" |
last4 | string | Last four digits of the card number |
expMonth | int | Expiry month (1–12) |
expYear | int | Expiry year (four-digit) |
type | string | Discriminator — "card" |
Deleting a payment method
Pass the payment method ID (prefixedpm_) to deletePaymentMethod():
Polar does not expose a server-side “add payment method” endpoint. Customers add new payment methods exclusively through the customer portal. Send them there with
$user->redirectToCustomerPortal().All of these methods —
paymentMethods(), deletePaymentMethod(), customerPortalUrl(), and redirectToCustomerPortal() — authenticate server-side on each call. Your admin access token is never sent to the browser.