# zarinpal-checkout

> Type-safe ZarinPal checkout client for Node.js with modern tooling and backwards-compatible API methods.

Latest version **1.1.1** (published 2026-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install zarinpal-checkout
pnpm add zarinpal-checkout
yarn add zarinpal-checkout
bun add zarinpal-checkout
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2026-07-11 |
| First published | 2016-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 52.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 83 |
| Author | siamak |
| Maintainers | siamak |
| Keywords | zarinpal, nodejs, checkout, typescript, payment |

## Links

- npm: https://www.npmjs.com/package/zarinpal-checkout
- Repository: https://github.com/siamak/zarinpal-checkout
- Homepage: https://github.com/siamak/zarinpal-checkout/wiki
- Issues: https://github.com/siamak/zarinpal-checkout/issues
- npm.io page: https://npm.io/package/zarinpal-checkout

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2026-07-11
- 1.1.0 — 2026-04-15
- 1.0.0 — 2026-04-15
- 0.3.0 — 2024-09-28
- 0.2.8 — 2024-02-19
- 0.2.7 — 2017-07-12
- 0.2.6 — 2017-06-26
- 0.2.5 — 2016-09-22
- 0.2.4 — 2016-06-09
- 0.2.3 — 2016-06-05
- 0.2.2 — 2016-06-01
- 0.2.1 — 2016-04-25
- 0.2.0 — 2016-04-24
- 0.1.3 — 2016-04-24
- 0.1.2 — 2016-04-24
- … 2 more at https://npm.io/package/zarinpal-checkout/versions

## README

# zarinpal-checkout

A modern, type-safe ZarinPal checkout client for Node.js. This `1.0.0` release keeps backward-compatible method names while upgrading internals, tooling, and tests.

![zarinpal-checkout cover](./cover.svg)

[![npm version](https://img.shields.io/npm/v/zarinpal-checkout.svg)](https://www.npmjs.com/package/zarinpal-checkout)
[![npm total downloads](https://img.shields.io/npm/dt/zarinpal-checkout?label=total%20downloads)](https://www.npmjs.com/package/zarinpal-checkout)
[![CI](https://github.com/siamak/zarinpal-checkout/actions/workflows/ci.yml/badge.svg)](https://github.com/siamak/zarinpal-checkout/actions/workflows/ci.yml)
[![Wiki](https://img.shields.io/badge/Wiki-Documentation-blue)](https://github.com/siamak/zarinpal-checkout/wiki)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)

## Features

- ✅ TypeScript-first with bundled type definitions
- ✅ Backward-compatible APIs (`create`, `PaymentRequest`, `PaymentVerification`, `UnverifiedTransactions`, `RefreshAuthority`, `TokenBeautifier`)
- ✅ Options-based client creation with `createWithOptions`
- ✅ Sandbox and production mode support
- ✅ Currency support for `IRR` and `IRT`
- ✅ Configurable request timeout handling
- ✅ Fast built-in Node.js test runner
- ✅ Strict linting + type-checking workflows
- ✅ Rollup build output (ESM + CJS) with declaration bundling
- ✅ Ready-to-run examples for all public methods

## Installation

```bash
# npm
npm install zarinpal-checkout

# yarn
yarn add zarinpal-checkout

# pnpm
pnpm add zarinpal-checkout
```

## Usage

Official ZarinPal documentation: [https://www.zarinpal.com/docs/](https://www.zarinpal.com/docs/)
Project wiki: [https://github.com/siamak/zarinpal-checkout/wiki](https://github.com/siamak/zarinpal-checkout/wiki)

### Express Example App

If you want a ready-to-run Express integration using this package, see:

- Repository: [zarinpal-express-checkout](https://github.com/siamak/zarinpal-express-checkout/blob/main/README.md)
- Raw README: [https://github.com/siamak/zarinpal-express-checkout/raw/refs/heads/main/README.md](https://github.com/siamak/zarinpal-express-checkout/raw/refs/heads/main/README.md)

### Backward-compatible API (recommended for existing users)

```ts
import ZarinpalCheckout from 'zarinpal-checkout';

const zarinpal = ZarinpalCheckout.create(
  'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
  false,
  'IRT'
);

const request = await zarinpal.PaymentRequest({
  Amount: 1000,
  CallbackURL: 'https://example.com/payment/callback',
  Description: 'Order #123',
  Email: 'user@example.com',
  Mobile: '09120000000'
});

console.log(request.url);
```

### Options-based API

```ts
import { createWithOptions } from 'zarinpal-checkout';

const zarinpal = createWithOptions('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {
  sandbox: true,
  currency: 'IRR',
  timeoutMs: 8000
});
```


## Examples

The `examples/` directory includes runnable examples for every public method:

- `examples/create-client.ts`
- `examples/payment-request.ts`
- `examples/payment-verification.ts`
- `examples/unverified-transactions.ts`
- `examples/refresh-authority.ts`
- `examples/token-beautifier.ts`

Run with your preferred TypeScript runtime (for example `tsx` or `ts-node`) after replacing the merchant ID and callback URLs.

## API Reference

### `PaymentRequest(input)`
Creates a payment authority.

### `PaymentVerification(input)`
Verifies a completed payment authority.

### `UnverifiedTransactions()`
Fetches unverified authorities.

### `RefreshAuthority(input)`
Refreshes an existing authority expiration.

### `TokenBeautifier(token)`
Preserves previous token beautifier behavior.

## Development

```bash
# npm
npm install && npm run lint && npm run typecheck && npm test && npm run build

```

## Author

- [Siamak Mokhtari](https://siamak.pro)

---
_Source: https://npm.io/package/zarinpal-checkout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
