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

# Customer Portal

> Enable customers to view & manage orders and subscriptions easily

The Customer Portal is a destination where your customers can see their orders and ongoing subscriptions. It’s also where they’re able to get hands on receipts, benefits, and more.

<img className="block dark:hidden" src="https://mintcdn.com/absolum/Ifc0gU26kXkWly1u/assets/features/customer-portal/overview.light.png?fit=max&auto=format&n=Ifc0gU26kXkWly1u&q=85&s=ca3edcc0d7d4e7421e2433b5a76542d7" width="2560" height="1600" data-path="assets/features/customer-portal/overview.light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/absolum/Ifc0gU26kXkWly1u/assets/features/customer-portal/overview.dark.png?fit=max&auto=format&n=Ifc0gU26kXkWly1u&q=85&s=d91d001a750dbd5e123566cd96f07388" width="2560" height="1600" data-path="assets/features/customer-portal/overview.dark.png" />

## Redirect to your Customer Portal

The customer portal is directly available from the URL `https://polar.sh/your-org-slug/portal`. Your customers will be able to authenticate there by entering the email they used to purchase or subscribe to your products.

<img className="block dark:hidden" src="https://mintcdn.com/absolum/Ifc0gU26kXkWly1u/assets/features/customer-portal/signin.light.png?fit=max&auto=format&n=Ifc0gU26kXkWly1u&q=85&s=48ff05e1c0a827d3e902a4e70d26dc17" width="2560" height="1600" data-path="assets/features/customer-portal/signin.light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/absolum/Ifc0gU26kXkWly1u/assets/features/customer-portal/signin.dark.png?fit=max&auto=format&n=Ifc0gU26kXkWly1u&q=85&s=162ab7ef14b1d7e350837b95b6229cdb" width="2560" height="1600" data-path="assets/features/customer-portal/signin.dark.png" />

Customer Portal Sign In

## Creating an authenticated Customer Portal Link

You can provide a pre-authenticated Customer Portal Link to your customers. This is handy if you want to redirect them directly from your application.

Using the Polar API, all you need is to call the `customerSessions` endpoint. Here’s an example using our TypeScript SDK.

```typescript theme={null}
import { Polar } from "@polar-sh/sdk";

const polar = new Polar({
  accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});

async function run() {
  const result = await polar.customerSessions.create({
    customerId: "<value>",
  });

  redirect(result.customerPortalUrl)
}

run();
```

Or, if you use NextJS as your framework, we have a handy utility which shortens down your code significantly.

```typescript theme={null}
// app/portal/route.ts
import { CustomerPortal } from "@polar-sh/nextjs";

export const GET = CustomerPortal({
  accessToken: process.env.POLAR_ACCESS_TOKEN,
  getCustomerId: async (req) => '<value>',
  server: 'sandbox' // Use sandbox if you're testing Polar - pass 'production' otherwise
});
```
