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

# Next.js with Clerk

> Learn how to integrate Chipi Pay with your Next.js application using Clerk for authentication and secure wallet storage.

## 1. Getting Started

To get started with Chipi Pay in your Next.js application

```bash theme={null}
npx create-next-app@latest my-chipi-app
cd my-chipi-app
```

> [!NOTE]
>
> If you get `ERESOLVE` peer dependency errors when installing Clerk, run `npm install --legacy-peer-deps`. This is a known Clerk + React 19 compatibility issue.

With Clerk, you can follow their [Quickstart Guide](https://clerk.com/docs/quickstarts/nextjs) to get started.

## 2. Install the Chipi SDK

First, install the required packages:

```bash theme={null}
# Install Chipi Pay SDK
npm install @chipi-stack/nextjs

# Install Clerk
npm install @clerk/nextjs
```

## 3. Setup the Chipi SDK Provider

1. Create a `.env` file in your project root and add your API keys:

```bash theme={null}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CHIPI_API_KEY=your_chipi_api_public_key
CHIPI_SECRET_KEY=your_chipi_api_secret_key
```

Get your Chipi API keys from the [Chipi Dashboard](https://dashboard.chipipay.com) quickstart. Get your Clerk keys from the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=api-keys).

2. Set up the Chipi Pay provider in your application:

```tsx theme={null}
// app/layout.tsx

import { ClerkProvider } from "@clerk/nextjs";
import { ChipiProvider } from "@chipi-stack/nextjs";

export default function RootLayout({children}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <ClerkProvider>
          <ChipiProvider>{children}</ChipiProvider>
        </ClerkProvider>
      </body>
    </html>
  );
}
```

> [!TIP]
>
> Need help? Check out our [Telegram Community](https://t.me/+e2qjHEOwImkyZDVh) for
> support and to connect with other developers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.