# litepay

> Wrapper for Litepay.ch API

Latest version **1.1.3** (published 2023-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install litepay
pnpm add litepay
yarn add litepay
bun add litepay
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2023-04-04 |
| First published | 2023-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 60 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ivan Admaers |
| Maintainers | admaers |

## Links

- npm: https://www.npmjs.com/package/litepay
- Repository: https://github.com/IvanAdmaers/litepay
- Homepage: https://github.com/IvanAdmaers/litepay#readme
- Issues: https://github.com/IvanAdmaers/litepay/issues
- npm.io page: https://npm.io/package/litepay

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.3.4

## Recent versions

- 1.1.3 (latest) — 2023-04-04
- 1.1.3-beta.0 (beta) — 2023-04-03
- 1.1.2 — 2023-03-11
- 1.1.1 — 2023-03-10
- 1.1.0 — 2023-03-07
- 1.0.0 — 2023-03-06

## README

# Litepay

<div align="center">
  <a href="https://www.npmjs.com/package/litepay">
    <img alt="npm version" src="https://img.shields.io/npm/v/litepay" />
  </a>
  <a href="https://www.npmjs.com/package/litepay">
    <img alt="npm downloads" src="https://img.shields.io/npm/dm/litepay" />
  </a>
    <a href="https://www.npmjs.com/package/litepay">
    <img alt="license" src="https://img.shields.io/npm/l/litepay" />
  </a>
</div>

Litepay.ch API wrapper.

<div align="center">
  <a href="https://github.com/IvanAdmaers/litepay">
    <img src="https://litepay.ch/assets/new/img/logo_litepay_2020_white_small.png" alt="Litepay logo" />
  </a>
</div>

## Usage

```js
import { Litepay } from 'litepay';

// Litepay.merchantCreate
(async () => {
  const invoice = await Litepay.merchantCreate({
    vendor: '0X3V5B',
    currency: 'USD',
    secret: '290657b6-2910-391s-vv2c-cbf84fc61f88',
    price: 99,
    callbackUrl: 'https://google.com',
    returnUrl: 'https://google.com',
    invoice: 1,
  });

  if (invoice.status === 'success') {
    console.log('redirect me to', invoice.url);
    return;
  }

  console.log('take a look on this error message', invoice.message);
})();

// Litepay.create
(async () => {
  const invoice = await Litepay.create({
    method: 'btc',
    receivingAddress: '1FfmbHfnpaZjKFvyi1okTjJJusN455paPH',
  });

  if (invoice.status === 'success') {
    console.log('client gotta pay to this address', invoice.address);
    return;
  }

  console.log('take a look on this error message', invoice.message);
})();

// Litepay.check
(async () => {
  const invoice = await Litepay.check({
    method: 'btc',
    address: 'address from invoice.address that returns the Litepay.create method',
  });

  if (invoice.status === 'error') {
    console.log('take a look on this error message', invoice.message);
    return;
  }

  if (+invoice.amount < 0.15) {
    console.log('invoice is not paid');
    return;
  }

  console.log('invoice is paid successfully');
})();
```

## Available methods:

* Litepay.merchantCreate
* Litepay.create
* Litepay.check

See the doc: https://litepay.ch/docs

## Testing

*Create .env first*

```
npm test
```

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