open-index/open-npm huggingface dataset:
npm package: @polymersuite/polymerpay-cli
Description: Polymer Pay CLI
Latest version: 0.1.0

# @polymersuite/polymerpay-cli

The official command-line interface for initializing and configuring the Polymer Pay SDK in your JavaScript or TypeScript projects.

## Overview

The Polymer Pay CLI provides a seamless, interactive onboarding experience. Instead of manually installing dependencies and writing boilerplate code, you can use the CLI to automatically set up the Polymer Pay client in seconds.

It is framework-agnostic and works perfectly with **Next.js, Express, NestJS, SvelteKit, Vue, React**, or plain Node.js scripts.

## Usage

You don't need to install the CLI globally. You can run it directly using your preferred package manager:

### Using npm

```bash
npx @polymersuite/polymerpay-cli init
```

### Using bun

```bash
bunx @polymersuite/polymerpay-cli init
```

### Using pnpm

```bash
pnpm dlx @polymersuite/polymerpay-cli init
```

### Using yarn

```bash
yarn dlx @polymersuite/polymerpay-cli init
```

## What it does

When you run the `init` command, the CLI will automatically:

1. **Detect your environment:** It intelligently detects if you are using TypeScript or JavaScript, and identifies your package manager (npm, yarn, pnpm, or bun).
2. **Install the SDK:** It installs the latest version of `@polymersuite/polymerpay-sdk` using your detected package manager.
3. **Generate the Client:** It creates a centralized, singleton client file (e.g., `src/lib/polymerpay.ts`) that initializes the SDK.
4. **Update Environment Variables:** It safely appends the `POLYMER_PAY_API_KEY` variable to your `.env` file.

## Example Output

```text
┌   Polymer Pay Setup
│
◇  Environment
│  Detected: TypeScript, src/ directory, bun package manager.
│
◆  Where would you like to initialize the client? (Press Enter to use default)
│  src/lib/polymerpay.ts
│
◇  Installing @polymersuite/polymerpay-sdk using bun...
│
◇  Creating src/lib/polymerpay.ts...
│
◇  Updating .env file...
│
└  ✅ Success! Polymer Pay is ready.

Next steps:
1. Add your API key to .env: POLYMER_PAY_API_KEY=your_key_here
2. Import the client anywhere in your app:
   import { polymer } from "./src/lib/polymerpay"; // Adjust path as needed
```

## Using the Generated Client

Once the CLI finishes, you can import the generated `polymer` instance anywhere in your application to interact with the API:

```typescript
import { polymer } from "@/lib/polymerpay";

async function createPayment() {
  const checkout = await polymer.checkout.create({
    amount: 1000,
    currency: "USD",
    successUrl: "https://example.com/success",
    cancelUrl: "https://example.com/cancel",
  });

  return checkout.url;
}
```

## Documentation

For full documentation, guides, and API reference, visit [docs.polymerpay.com](https://docs.polymerpay.com).