Skip to main content

Installation

Package Installation

Install the SDK using npm, yarn, or pnpm:

# npm
npm install @zkp2p-pay/sdk

# yarn
yarn add @zkp2p-pay/sdk

# pnpm
pnpm add @zkp2p-pay/sdk

Requirements

  • Node.js 18+ (for server-side usage)
  • Modern browser with fetch support (for client-side usage)

Importing

The SDK uses ES modules:

import { createCheckoutSession, redirectToCheckout } from '@zkp2p-pay/sdk';

If you're using CommonJS, you'll need to use dynamic imports:

const { createCheckoutSession } = await import('@zkp2p-pay/sdk');

TypeScript Support

The SDK is written in TypeScript and includes type definitions. No additional @types package is needed.

import type { CheckoutClientOptions, CreateSessionRequest } from '@zkp2p-pay/sdk';

const options: CheckoutClientOptions = {
apiBaseUrl: 'https://api.zkp2p-pay.xyz',
apiKey: 'your_api_key',
};

const request: CreateSessionRequest = {
merchantId: 'merchant_123',
amountUsdc: '50.00',
destinationChainId: 8453,
destinationToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
recipientAddress: '0xYourWallet',
};

Shared Types

The SDK re-exports types from @zkp2p-pay/shared. You can also install the shared package directly if you only need types:

npm install @zkp2p-pay/shared
import type { Order, CheckoutSession, WebhookPayload } from '@zkp2p-pay/shared';