
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A NodeJS wrapper for the SnapScan API.
I am not affiliated with SnapScan by any means and this is not an official API wrapper, but it is pretty cool.
This module uses some newer Javascript syntax, so it currently only supports node v4+. If someone really wants support for something below that, let me know and we can take a look at adding support for that.
The module can also technically work browser or server-side, but I would recommend using it server-side if possible since you will be passing in your apiKey and merchant name.
All methods return Javascript Promises with JSON objects as return data.
For the npm okes
npm install --save snapscan
or using yarn
yarn add snapscan
const SnapScan = require('snapscan')
const snapscan = new SnapScan({
apiKey: '<your_api_key>',
merchant: '<your_merchant_name>'
})
// Example method you can use to get your SnapCode/QR Code link and image
snapscan.getQRCode()
.then((snapCode) => {
console.log(snapCode)
// logs object containing `urlLink` and `imageLink`
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
If you feel so inclined, consider sponsoring some tattoo money.
Take a look at the official SnapScan API documentation for all possible endpoints and parameters. Everything is supported in this API Wrapper.
Used to generate your SnapCode/QR Code to display on a website, etc.
All parameters are optional.
snapCode - If you want to generate a SnapCode other than for your given merchant accountid - Specify additional reference that is unique to the SnapCode. Will be associated to merchantReference in paymentsamount - Pre-populate owed amountstrict - {true/false} Set to true to prevent customer from paying the same reference (id) twice or to edit the payment amountsnapCodeType - The image file type to return. Either svg or png (Defaults to svg)snapCodeSize - The size of the image - between 50 and 500 (Defaults to 125)snapscan.getQRCode({
id: 'order 51',
amount: 250,
strict: true,
snapCodeType: 'png',
snapCodeSize: 300
})
.then((snapCode) => {
console.log(snapCode)
// logs object containing `urlLink` and `imageLink`
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
The API’s main purpose is to provide you with various ways to query the status of payments that were made against your merchant account.
All parameters are optional.
startDate - Payments that were started at or after this time, eg: '2000-01-01T01:00:00Z'endDate - Payments that were started before this time, eg: '2000-01-01T01:00:00Z'status - A comma separated string of the following values: completed, error or pending, eg. 'completed,pending'snapCode - Payments with the SnapCode.snapCodeReference - Payments with the SnapCode reference.userReference - Payments with the user reference.merchantReference - Payments with your reference.statementReference - Payments included in the settlement with the provided reference.snapscan.getPayments({
startDate: '2000-01-01T01:00:00Z',
status: 'completed,pending'
})
.then((payments) => {
console.log(payments)
// logs array of payment objects
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
Returns a single payment.
This method only takes one required argument, namely the payment id
snapscan.getPayment(123)
.then((payment) => {
console.log(payment)
// logs payment object
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
Returns all payments that were completed successfully in the specified cash up period. If a cash up period contains any pending payments, the promise will reject. A cash up period is considered complete once the SnapScan guys know the status of all the payments within the period. See Cash Ups for more details.
This method only takes one required argument, namely the cash up period's reference
snapscan.getCashUpPayments('1e07ac748d2627ba')
.then((payments) => {
console.log(payments)
// logs array of payment object
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
The cash up API allows you to mark the end of your transaction period on the SnapScan system. Once a transaction period has been marked you will be able to query all payments that were completed within the associated period.
This method returns a reference that marks the end of the current transaction period and the start of a new one. The reference can be used to retrieve all the payments that were successfully completed in the associated period (using the getCashUpPayments() method above).
This method takes no parameters
snapscan.cashUp()
.then((cashUp) => {
console.log(cashUp)
// logs the cashUp object containing the `date` and `reference`
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
Returns a paginated list of all cash up references that have been created. The references are ordered by descending date.
This method takes no parameters
snapscan.getCashUps()
.then((cashUps) => {
console.log(cashUps)
// logs array of cashUp objects
})
.catch((error) => {
console.error(error)
// logs error thrown if anything failed
})
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
FAQs
A NodeJS wrapper for the SnapScan API
We found that snapscan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.