Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gillstrom/swish-qr
Generate a Swish QR code
https://github.com/gillstrom/swish-qr
cli code javascript nodejs qr swish
Last synced: about 2 months ago
JSON representation
Generate a Swish QR code
- Host: GitHub
- URL: https://github.com/gillstrom/swish-qr
- Owner: gillstrom
- License: mit
- Created: 2017-06-19T06:26:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-30T12:30:45.000Z (over 7 years ago)
- Last Synced: 2024-12-07T21:09:53.542Z (about 2 months ago)
- Topics: cli, code, javascript, nodejs, qr, swish
- Language: JavaScript
- Size: 65.4 KB
- Stars: 23
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# swish-qr [![Build Status](https://travis-ci.org/gillstrom/swish-qr.svg?branch=master)](https://travis-ci.org/gillstrom/swish-qr)
> Generate a [Swish](https://www.getswish.se/) QR code
## Install
```
$ npm install swish-qr
```## Usage
```js
const swishQr = require('swish-qr');swishQr({
amount: 100,
lock: ['amount', 'number'],
message: 'Lorem ipsum',
number: '0701234567'
}).then(result => {
console.log(result);
//=> 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL...'
});
```## API
### swishQr(options)
Returns a `Promise` resolving in to a `base64` string.
### swishQr.sync(options)
Returns a `base64` string.
### swishQr.generateString(options)
Returns a formatted string that's used to create the QR code.
#### options
*Required*
Type: `Object`##### amount
Type: `float`
Default: `0`The amount of money to send.
##### lock
Type: `Array`
Default: `[]`Lock fields in the Swish application from user input.
##### message
Type: `string`
Default: `''`Define a message to send.
##### number
Type: `string`
Default: `''`The recipient.
## Related
* [swish-qr-cli](https://github.com/gillstrom/swish-qr-cli) - CLI for this module.
## License
MIT © [gillstrom](http://github.com/gillstrom)