Checkouts & Checkout Links
Relevant source files
The following files were used as context for generating this wiki page:
- server/polar/checkout/service.py
- server/polar/checkout_link/service.py
- clients/apps/app/app/(authenticated)/checkout-links/new/index.tsx/checkout-links/new/index.tsx)
- clients/apps/web/src/app/(main)/dashboard/[organization]/(header)/products/checkout-links/page.tsx/dashboard/[organization]/(header)/products/checkout-links/page.tsx)
- clients/apps/web/src/components/Finance/Account/sections/SetupReadinessSection.tsx
- server/polar/organization_review/analyzer.py
Checkouts and Checkout Links form the core monetization infrastructure of the Polar platform. They enable organizations to sell digital products, subscriptions, and software licenses with minimal integration effort. While a Checkout represents an individual transaction instance, a Checkout Link is a reusable, pre-configured URL that generates Checkouts for customers on demand.
The system is designed to handle global tax compliance, Merchant of Record (MoR) responsibilities, and automated benefit delivery. Organizations can create these links through the dashboard or programmatically via the API to streamline their sales funnels across social media, email, or direct website integrations.
Architecture and Data Flow
The relationship between Checkout Links and Checkouts is one-to-many. A single Checkout Link acts as a template containing product configurations, pricing overrides, and success redirect rules.
Checkout Link Generation
Checkout Links are created by organizations to define what is being sold and how the checkout experience should behave. They can include specific products, discount codes, and metadata.
Key Components
| Component | Description |
|---|---|
| Checkout Link | A reusable URL (/v1/checkout-links/{id}/redirect) that serves as a entry point for sales. |
| Checkout Session | A transient instance representing a specific customer's intent to buy, linked to a payment processor. |
| Product Configuration | Defines which items are included in the checkout and if they have attached benefits. |
| Success URL | The destination where a customer is sent after successful payment, often containing a {CHECKOUT_ID} placeholder. |
Sources: server/polar/organization_review/analyzer.py:610-630, clients/apps/app/app/(authenticated)/checkout-links/new/index.tsx:165-180
Implementation Details
Checkout Link Creation
When creating a new Checkout Link, several parameters define its behavior, including tax requirements and discount accessibility.
type CheckoutLinkCreateForm = {
label: string
success_url: string
allow_discount_codes: boolean
require_billing_address: boolean
metadata: { key: string; value: string }[]
}
Sources: clients/apps/app/app/(authenticated)/checkout-links/new/index.tsx:32-38
The creation process allows for:
- Product Selection: Associating one or more digital products with the link.
- Success URL Customization: Dynamically receiving the Checkout ID on the landing page using placeholders.
- Discount Controls: Toggling whether customers can apply their own discount codes.
- Metadata: Attaching custom key-value pairs for internal tracking or integration logic.
Sources: clients/apps/app/app/(authenticated)/checkout-links/new/index.tsx:143-188
Verification and Compliance
Polar performs automated reviews of Checkout Links to ensure they meet "Setup Readiness" standards. An organization is considered ready to sell if their links or integrations meet specific safety criteria.
Readiness Criteria:
- Benefits Attachment: At least one checkout link must have benefits attached so customers receive value after payment.
- Success URL Integrity: The system detects cross-domain redirects. If a Success URL redirects to a domain different from the organization's verified domain, it is flagged as high risk to prevent phishing or prohibited content delivery.
- Domain Consistency: Webhook and return URL domains should match the organization's website.
Sources: server/polar/organization_review/analyzer.py:114-124, clients/apps/web/src/components/Finance/Account/sections/SetupReadinessSection.tsx:88-105
Management and UI
The dashboard provides a Master-Detail interface for managing these assets. Organizations can view existing links, create new ones, and monitor their status.
Dashboard Views
The web client handles empty states and redirection to the most recently created link to improve user workflow.
# Logic for redirecting to newest checkout link
if data?.items && data.items.length > 0:
const redirectUrl = `/dashboard/${organization.slug}/products/checkout-links/${data.items[0].id}`
return <MasterDetailIndex redirectTo={redirectUrl} />
Setup Readiness UI
The setup UI categorizes integration paths into "No-code" (Checkout Links) and "API integration" (API keys and Webhooks).
| Path | Requirement for "Ready" Status |
|---|---|
| No-code | A checkout link with a product that has a benefit attached OR a success URL set. |
| API Integration | Valid API Access Token and at least one enabled Webhook for real-time consistency. |
Sources: clients/apps/web/src/components/Finance/Account/sections/SetupReadinessSection.tsx:68-150
Conclusion
Checkouts and Checkout Links provide a structured yet flexible way for developers to monetize software. By combining the ease of "No-code" shareable links with rigorous backend compliance checks and Merchant of Record protections, Polar ensures that the transition from a product description to a successful transaction is secure and compliant for both the organization and the customer.