@polymersuite/polymerpay-cli
v0.1.2
Published
Polymer Pay CLI
Readme
@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
npx @polymersuite/polymerpay-cli initUsing bun
bunx @polymersuite/polymerpay-cli initUsing pnpm
pnpm dlx @polymersuite/polymerpay-cli initUsing yarn
yarn dlx @polymersuite/polymerpay-cli initWhat it does
When you run the init command, the CLI will automatically:
- Detect your environment: It intelligently detects if you are using TypeScript or JavaScript, and identifies your package manager (npm, yarn, pnpm, or bun).
- Install the SDK: It installs the latest version of
@polymersuite/polymerpay-sdkusing your detected package manager. - Generate the Client: It creates a centralized, singleton client file (e.g.,
src/lib/polymerpay.ts) that initializes the SDK. - Update Environment Variables: It safely appends the
POLYMER_PAY_API_KEYvariable to your.envfile.
Example Output
┌ 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 neededUsing the Generated Client
Once the CLI finishes, you can import the generated polymer instance anywhere in your application to interact with the API:
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.
