> ## Documentation Index
> Fetch the complete documentation index at: https://polar.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkout Links

> Persistent URLs that create a Checkout Session on visit

This is the simplest way to start selling. Configure once in the dashboard, share the URL anywhere (your website, social media, email, a button in your app), and Polar handles the rest.

<Tip>
  If you need to create Checkout Sessions programmatically (e.g. with per-customer data computed by your backend), use the [Checkout API](/features/checkout/session) directly instead.
</Tip>

## How it works

A Checkout Link is a long-lived URL tied to your organization. The link itself doesn't expire, and you can share it indefinitely.

When a customer visits the link:

1. Polar reads the link's configuration (products, preset discount, metadata, etc.).
2. A new, short-lived Checkout Session is created from that configuration.
3. The customer is redirected to the session's checkout page to complete the purchase.

Each visit produces a brand new Checkout Session. Always share the Checkout Link URL itself, never the URL of a generated Checkout Session, since those are temporary and will expire.

## Create a Checkout Link

Checkout Links are managed from the **Checkout Links** tab of the Products section. Click on **New Link** to create one.

### Products

You can select one or several products. With several products, customers can switch between them on the checkout page before paying.

<Note>
  Customers always purchase a single product per checkout. Selecting multiple products on a Checkout Link gives the customer a choice between them; it doesn't bundle them together. True multi-product checkout (multiple products in the same order) isn't supported yet.
</Note>

### Discount

You can preset a discount on the link. It will be **automatically applied** when the customer lands on the checkout page, with no action required from them. Useful for running promotions or offering special pricing through specific links.

If **Allow discount codes** is enabled, customers can still manually enter another discount code during checkout.

<Tip>
  Discounts without a code can only be applied through Checkout Link presets or the [Checkout API](/features/checkout/session). Learn more in the [Discounts documentation](/features/discounts).
</Tip>

### Success URL

URL where the customer is redirected after a successful payment. If left empty, the customer stays on the Polar-hosted confirmation page.

You can add the `checkout_id={CHECKOUT_ID}` query parameter to the Success URL and Polar will substitute it with the actual Checkout Session ID at redirect time. This is handy to fetch the order details from your backend on the confirmation page.

### Return URL

URL for the back button shown on the checkout page. When the customer clicks it, they're sent back to this URL (typically your pricing page or the previous page on your site). If not set, no back button is shown.

### Trial

If the link's products are subscriptions, you can configure a trial period directly on the Checkout Link. When set, this trial **overrides** the default trial configured on the products themselves, but only for sessions created from this link.

This is useful for running campaigns with longer (or shorter) trials than your default, without having to duplicate the product. If left empty, the product's own trial configuration is used.

### Metadata

An optional key-value object for storing extra information. Metadata set on the link is copied to the generated Checkout Session, and propagates to the resulting Order and/or Subscription on success.

## Query parameters

Append query parameters to a Checkout Link URL to override or extend its preset configuration on a per-visit basis.

### Preselect a product

When a link is configured with several products, point the customer directly to one of them using `product_id`. The customer can still switch products on the checkout page.

<ParamField path="product_id" type="string">
  ID of the product to preselect. Must be one of the products configured on the Checkout Link.
</ParamField>

### Prefill fields

<ParamField path="customer_email" type="string">
  Prefill the customer email.
</ParamField>

<ParamField path="customer_name" type="string">
  Prefill the customer name.
</ParamField>

<ParamField path="discount_code" type="string">
  Prefill the discount code input. Only works with discounts that have a code set. See the [Discounts documentation](/features/discounts) for details.

  This is different from presetting a discount on the link. A preset discount is silently applied, whereas `discount_code` only fills the input field so the customer can see it.
</ParamField>

<ParamField path="amount" type="string">
  Prefill the amount when the product uses Pay-What-You-Want pricing.
</ParamField>

<ParamField path="locale" type="string">
  Force the checkout page language, given as an IETF BCP 47 language tag (e.g.
  `en`, `fr`, `pt-BR`). If omitted, the language is detected from the
  customer's browser. Checkout localization is in beta. See
  [Checkout Localization](/features/checkout/localization) for details.
</ParamField>

<ParamField path="custom_field_data.{slug}" type="string">
  Prefill custom field data, where `{slug}` is the slug of the custom field.
</ParamField>

### Attribution and reference metadata

These parameters are automatically attached to the generated Checkout Session [`metadata`](/api-reference/checkouts/get-session#response-metadata).

<ParamField path="reference_id" type="string">
  Your own reference ID for the Checkout Session.
</ParamField>

<ParamField path="utm_source" type="string">
  UTM source of the Checkout Session.
</ParamField>

<ParamField path="utm_medium" type="string">
  UTM medium of the Checkout Session.
</ParamField>

<ParamField path="utm_campaign" type="string">
  UTM campaign of the Checkout Session.
</ParamField>

<ParamField path="utm_content" type="string">
  UTM content of the Checkout Session.
</ParamField>

<ParamField path="utm_term" type="string">
  UTM term of the Checkout Session.
</ParamField>
