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.
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 asexternal_id:
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 theurl in the response:
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.
Verify it works
Open the checkout URL and pay with Stripe’s test card4242 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.
- Dashboard
- CLI
- Prompt
- 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.

