Skip to content
Scanpay node.js client library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Scanpay node.js client

Node.js client library for the Scanpay API. You can always e-mail us at or chat with us on or #scanpay at Freenode (webchat)


This package works with Node.js >= 6.6. You can install the package with npm:

npm install scanpay --save

You can then include it in your project with:

const scanpay = require('scanpay')('API key');

Manual installation

If you do not wish to use npm, you can download the latest release and include in into your project:

const scanpay = require('lib/scanpay.js')('API key');


The API documentation is available here. All methods, except handlePing, will return a Promise. Most methods accept an optional per-request object with options, here referred to as options.

newURL(Object, options) => String

Create a link to our hosted payment window (docs | example).

const order = {
    items: [{ total: '6000 DKK' }]
scanpay.newURL(order, options)
    .then(url => console.log(url))
    .catch(err => { /* handle errors */ });

seq(Int, options) => Object

Make a sequence request to pull changes from the server (docs | example).

const localSeq = 921;
scanpay.seq(localSeq, options)
    .then(obj => console.log(obj.changes))
    .catch(err => { /* handle errors */ });

handlePing(String, String)

Handle and validate synchronization pings. The method accepts two arguments, the body of the received ping and the X-Signature HTTP header. The method returns an object (docs | example).

try {
    const json = scanpay.handlePing(body, req.headers['x-signature']);
} catch (e) { /* handle errors */ }


All methods, except handlePing, accept an optional per-request options object. You can use it to:

  • Set the API key for this request (example)
  • Set HTTP headers, e.g. the highly recommended X-Cardholder-IP (example)
  • Change the hostname to use our test environment (example)

Compatibility table

Nodejs compatibility table for this library.

Feature Version
crypto.timingSafeEqual 6.6
Arrow functions 6.0
Default function parameters 6.0
Array.isArray 6.0
Buffer.from 5.10


Everything in this repository is licensed under the MIT license.

You can’t perform that action at this time.