# iotapay

> Pay using IOTA

Latest version **1.2.2** (published 2019-04-23) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2019-04-23 |
| First published | 2018-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.9.4 |
| Dependencies | 3 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kumar Anirudha |
| Maintainers | anistark |
| Keywords | iotapay, anistark, acyclic, tangle |

## Links

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

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.88.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.4
- [iota.lib.js](https://npm.io/package/iota.lib.js.md) ^0.5.1

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2019-04-23
- 1.2.1 — 2019-04-23
- 1.2.0 — 2019-04-21
- 1.1.0 — 2019-04-18
- 1.0.2 — 2019-04-06
- 1.0.1 — 2019-04-06
- 0.0.1 — 2019-04-06
- 1.0.0 — 2018-09-02

## README

# [IOTAPAY](https://iotapay.dev/)

[![GitHub package.json version](https://img.shields.io/github/package-json/v/acycliclabs/iotapay-js.svg)](https://github.com/acycliclabs/iotapay-js/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![node](https://img.shields.io/badge/node-%3E%3D8.9.4-brightgreen.svg)](https://nodejs.org/download/release/v8.9.4/)
[![npm](https://img.shields.io/npm/dt/iotapay.svg)](https://www.npmjs.com/package/iotapay)
[![NPM](https://nodei.co/npm/iotapay.png)](https://nodei.co/npm/iotapay/)


[NodeJs](https://nodejs.org/) library to Pay using IOTA

# Setup

Install the library `npm install iotapay`

Import package: `require('iotapay');`

Initialize:
```
new IOTAPAY({
    host : 'http://node06.iotatoken.nl:14265'
});
```

***

## Basic functions

<details><summary>Initialize:</summary>
<p>

#### Initialize the iotapay object.

```javascript
const iotapay = new IOTAPAY();
```

Set Host manually like this:

```javascript
iotapay.setHost('http://node06.iotatoken.nl:14265');
```

or we will find a suitable host for you like this:

```javascript
iotapay.findHost(function (err, host) {
    if(err) {
        console.log('error:', err);
    }    
    iotapay.setHost(host);
})
```

</p>
</details>

***

<details><summary>Get Balance:</summary>
<p>

#### Retrieve Balance

```javascript
iotapay.getBalance(['ADDRESS'], function (err, balance) {
    if(err) {
        console.log('error:', err);
    }
    console.log('balance:', balance);
})
```

</p>
</details>

***

<details><summary>Pay:</summary>
<p>

#### Transfer iota as payment.

```javascript
iotapay.transfer({
    address: 'ADDRESS',
    value: 1,
    message: 'Testing',
    seed: 'SEED'
}, function (err, result) {
    if(err) {
        console.log('error:', err);
    }
    console.log('result:', result);
})
```

Result gives bundle hash.

</p>
</details>

***

#### More Functions coming soon.

NOTE: Please, use proper iota node url, ADDRESS and your SEED to initialise. These are simple dummy values. NOT meant for production usage.

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