Skip to main content
Why this matters: Every order, subscription, benefit and usage event belongs to a customer. Linking customers to your own users by external ID means you never have to store Polar’s IDs. See Customers.
In this step you’ll create a customer for one of your users, then send them to a checkout for Pro. The examples use the sandbox client from the quickstart overview, on API version 2026-10.

Create the customer when a user signs up

Create a Polar customer when a user signs up in your application, with your user ID as external_id:
To add a test customer by hand, open Customers, click +, fill in Email and External ID, and click Create Customer. From the CLI: polar customers create --email jane@example.com --external-id user_123. The events you sent in step 1 with external_customer_id: "user_123" now belong to this customer. Creating customers up front is optional, since checkout creates the customer if it doesn’t exist. Doing it at sign-up means usage, free plans and the customer portal work from the first moment.

Send the user to checkout

When the user clicks Upgrade, create a checkout session from your backend and redirect them to the url in the response:
Passing external_customer_id ties the purchase to your user and locks the email field to theirs. After paying, the customer returns to your success_url, with {CHECKOUT_ID} replaced by the session ID.
Don’t need per-user sessions? Create a Checkout Link under Products → Checkout Links, or with polar checkout_links create, and link to it from your pricing page. To keep customers on your site, use embedded checkout.

Verify it works

Open the checkout URL and pay with Stripe’s test card 4242 4242 4242 4242, any future expiry date and any CVC. Then check Jane’s customer: she has an active Pro subscription and 100,000 credited tokens on the AI tokens meter. In the customer state, these are active_subscriptions and active_meters.
  • Open Customers
  • Select Jane
  • Overview lists the Pro subscription
  • Usage shows the AI tokens meter and its credits

Learn more

Next: Sync customer state

Grant access in your application when the subscription starts or changes.