# lunar-payments

> 3rd party node.js api client for Lunar payment gateway https://lunar.app/

Latest version **0.1.2** (published 2022-10-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install lunar-payments
pnpm add lunar-payments
yarn add lunar-payments
bun add lunar-payments
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-10-02 |
| First published | 2022-10-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 53 KB |
| Known vulnerabilities | 0 (+16 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexander Møller |
| Maintainers | hundeklemmen, nickant |
| Keywords | lunar, payments, online, lunar-online-payments, lunar-payments, lunar.app, paylike, paylike.io |

## Links

- npm: https://www.npmjs.com/package/lunar-payments
- Repository: https://github.com/Hundeklemmen/lunar-payments
- Homepage: https://github.com/Hundeklemmen/lunar-payments#readme
- Issues: https://github.com/Hundeklemmen/lunar-payments/issues
- npm.io page: https://npm.io/package/lunar-payments

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.4.0
- [undici](https://npm.io/package/undici.md) ^5.10.0
- [bson-objectid](https://npm.io/package/bson-objectid.md) ^2.0.3

## Recent versions

- 0.1.2 (latest) — 2022-10-02
- 0.1.1 — 2022-10-02
- 0.1.0 — 2022-10-02

## README

# Lunar Payments
3rd party Node.js api client to community with the Danish payment gateway `Lunar Online Payments` https://lunar.app/

## Installation
```bash
npm i lunar-payments --save
```

## Example
```ts
import { LunarPaymentClient } from "lunar-payments";
// or
const { LunarPaymentClient } = require("lunar-payments").default;

let lunarPayment = new LunarPaymentClient({
    appKey: "",
    merchantId: "", // Optional, it will be fetched from Lunar and cached if not provided
});

const transactionID = "Transaction ID here";
const lineID = "Line ID here";



let merchant = await lunarPayment.getMerchant();
console.log("Merchant ID", merchant.id);
console.log("Merchant name", merchant.name);


let identity = await lunarPayment.getIdentity();
console.log("Identity ID", identity.id);


let transaction = await lunarPayment.transactions.fetch(transactionID);

console.log("result", transaction)


let lines = await lunarPayment.lines.fetch(lineID);
console.log("lines", lines)
```


### Where to find appKey?
You can find the appKey in your Lunar busness account dashboard. Go to Online Payments -> Complete your registration -> App Key


### Where to find merchantId?
*It is recommended that you provide the merchantId in the constructor of the LunarPaymentClient, so the client does not have to fetch it from Lunar every time the client is instantiated.*

Easiest way to retrieve the merchantId is by using the `getMerchant` method. The method will return the merchant object, which contains the merchantId.

```ts
let merchant = await lunarPayment.getMerchant();
console.log("Merchant ID", merchant.id);
```

### Supported features
- [x] Transactions
    - [x] List transactions
    - [x] Fetch transaction
    - [x] Capture transaction
    - [x] Refund transaction
    - [x] Void transaction
- [x] Lines
    - [x] List lines
    - [x] Fetch line
- [x] Fetch identity
- [x] Fetch merchant


### Suggestions
If you have any suggestions, please create an issue or a pull request.

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