Installation
Get started with the ZenPays JavaScript SDK in your project.
Requirements
- Node.js 18.0 or later
- npm, yarn, or pnpm
Install the package
- npm
- yarn
- pnpm
npm install zenpays
yarn add zenpays
pnpm add zenpays
TypeScript Support
The SDK is written in TypeScript and includes complete type definitions out of the box. No additional @types/* package is needed.
import type { PaymentIntent } from 'zenpays'
import { ZenPays } from 'zenpays'
const zenpays = new ZenPays({
apiKey: process.env.ZENPAYS_API_KEY!,
})
// Full type safety
const intent: PaymentIntent = await zenpays.payments.getPaymentIntent('pi_xxx')
Browser Support
The SDK works in both Node.js and browser environments. For browser usage, you can import directly:
<script type="module">
import { ZenPays } from 'https://unpkg.com/zenpays@latest/dist/index.mjs'
const zenpays = new ZenPays({
apiKey: 'your-publishable-key',
})
</script>
warning
Never expose your secret API key in client-side code. Use publishable keys for browser environments.
Next Steps
- Quick Start - Create your first payment
- Configuration - Learn about SDK options
- Authentication - Manage API keys