npm package: @joyida/payme
Description: Zero-dependency, fully typed client SDK for Payme Merchant API - Integrate Payme payments into your Bun backend with JSON-RPC 2.0
Author: Joyida Team
Latest version: 0.2.0

# @joyida/payme

> Zero-dependency, fully typed SDK for Payme Merchant API and Subscribe API

Integrate Payme payments and card tokenization into your Bun application with JSON-RPC 2.0 protocol.

[![NPM Version](https://img.shields.io/npm/v/@joyida/payme.svg)](https://www.npmjs.com/package/@joyida/payme)
[![CI](https://github.com/joyida/payme/actions/workflows/ci.yml/badge.svg)](https://github.com/joyida/payme/actions/workflows/ci.yml)
[![Docs](https://github.com/joyida/payme/actions/workflows/docs.yml/badge.svg)](https://github.com/joyida/payme/actions/workflows/docs.yml)
[![Bun](https://img.shields.io/badge/bun-%3E%3D1.3.9-orange.svg)](https://bun.sh/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
[![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)](package.json)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)


## Features

- 🚀 Zero dependencies
- 💪 Fully typed with TypeScript
- 📦 JSON-RPC 2.0 protocol
- 🔒 Type-safe payment operations
- 💳 Card tokenization (Subscribe API)
- 🧾 Receipt management (Subscribe API)
- 🌍 Localized error messages (RU, UZ, EN)
- ✅ Built-in validation
- 📦 ESM + CommonJS support
- ⚡ Optimized for Bun runtime
- 📦 Bundle size < 15KB

## Installation

```bash
bun add @joyida/payme
```

## Quick Start

### Merchant API (Payment Processing)

```typescript
import { PaymeMerchant } from '@joyida/payme';

const payme = new PaymeMerchant({
  secretKey: 'your_secret_key',
});

// Check if payment is possible
const check = await payme.checkPerformTransaction({
  amount: 500000, // 5000 so'm (in tiyin)
  account: { order_id: 'ORD-123' }
});

if (check.allow) {
  console.log('Payment allowed');
}
```

### Subscribe API (Card Tokenization)

```typescript
import { PaymeSubscribe } from '@joyida/payme';

// Client-side mode (for card tokenization)
const subscribe = new PaymeSubscribe({
  merchantId: 'your_merchant_id'
}, 'client');

// Create card token
const result = await subscribe.cardsCreate({
  card: { 
    number: '8600069195406311', 
    expire: '0399' 
  },
  save: true
});

console.log(result.card.token); // Use for payments
```

## Documentation

**Live docs:** [joyida.github.io/payme](https://joyida.github.io/payme/) (after GitHub Pages is enabled; see below)

**[Source / edit locally →](./docs/index.md)** — `bun run docs:dev`

- [Getting started](./docs/guides/getting-started.md) · [Configuration](./docs/guides/configuration.md) · [Authentication](./docs/guides/authentication.md)
- [Merchant API](./docs/api/merchant-api.md) · [Subscribe API](./docs/api/subscribe-api.md)
- [Error handling](./docs/api/error-handling.md) · [Validation](./docs/api/validation.md) · [Error code examples](./docs/examples/error-codes-usage.md)
- [Payment flow](./docs/guides/payment-flow.md) · [Card tokenization](./docs/guides/card-tokenization.md) · [Testing](./docs/guides/testing.md)

## Bundle Size

- **~8.8KB** minified (CommonJS)
- **~25KB** minified (ESM)
- **~3KB** gzipped
- Zero dependencies

## Requirements

- Bun >= 1.3.9 (required; this package is tested and supported only on Bun)

## Links

- [NPM Package](https://www.npmjs.com/package/@joyida/payme)
- [GitHub Repository](https://github.com/joyida/payme)
- [Payme Documentation](https://developer.help.paycom.uz/)
- [Payme Website](https://payme.uz)

## License

MIT © [Joyida Team](https://github.com/joyida)

## Support

- [GitHub Issues](https://github.com/joyida/payme/issues)
- Email: support@joyida.uz

---

Made with ❤️ for Uzbekistan developers