# checkeeper-client

> API client and signature generator for Checkeeper

Latest version **0.3.0** (published 2024-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install checkeeper-client
pnpm add checkeeper-client
yarn add checkeeper-client
bun add checkeeper-client
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2024-10-07 |
| First published | 2023-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 30.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jekh |
| Keywords | checkeeper |

## Links

- npm: https://www.npmjs.com/package/checkeeper-client
- npm.io page: https://npm.io/package/checkeeper-client

## Recent versions

- 0.3.0 (latest) — 2024-10-07
- 0.2.0 — 2023-02-12
- 0.1.0 — 2023-02-06

## README

# Checkeeper Client

A zero-dependency node client for the [Checkeeper API](https://checkeeper.com/api).

## Requirements

- Node 20+
- ESM-only: The client must be imported using `import` or dynamic `import()`

## Usage

### Create Check API

```ts
import { Configuration, CheckeeperClient } from "checkeeper-client"

const configuration: Configuration = {
  token: "your-checkeeper-token",
  secret: "your-checkeeper-secret",
  testMode: true, // Sends all requests as "test" requests
}

const client = new CheckeeperClient(configuration)

// Create a PDF of a check, but do not mail it
await client.createCheckPDF({
  /* See CreateCheckOptions */
})

// Mail a check (does not return a PDF -- use getCheckImage() to retrieve an image)
await client.mailCheck({
  /* See MailCheckOptions */
})

// See CheckeeperClient docs for available API calls.
```

### Base64 utilities

When specifying fields that require base64 binary data, such as `logo`, `signerImage`, and `attachment`, use `binaryDataToBase64` to convert a `Buffer` or `ReadableStream` to base64.

```ts
const logo = Buffer.from(/*...*/)
const signerImage = fs.createReadStream("signature.png")
const attachment = fs.createReadStream("attachment.pdf")

client.createCheckPDF({
  logo: binaryDataToBase64(logo),
  attach: binaryDataToBase64(attachment),
  signerImage: binaryDataToBase64(signerImage),
  // ...
})
```

When receiving a base64-encoded image in a Checkeeper response, use `base64ToBuffer` or `base64ToStream` to convert the image to a Buffer or ReadableStream.

```ts
const resp = await client.createCheckPDF({
  /* ... */
})

if (resp.success) {
  fs.writeFileSync("check.pdf", base64ToBuffer(resp.pdf))
  // Or
  const fileStream = fs.createWriteStream("check-image.jpg")
  base64ToStream(resp.pdf).pipe(fileStream)
}
```

### Checkeeper Signature

The Checkeeper signature generator can be used independently, in place of the `checkeeper-signature` package.

```ts
import { getCheckeeperRequestSignature } from "checkeeper-client"

const signature = getCheckeeperRequestSignature(
  {
    /* Checkeeper request parameters */
  },
  "your-checkeeper-secret"
)
```

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