0.0.18 • Published 5 years ago

nmi-node v0.0.18

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Node SDK for Networking Merchants Inc's (NMI) Three Step Redirect API

Installation

npm install nmi-node

Documentation

Module documentation

NMI Three Step Redirect API docs

Notes

All attribute names recieved from NMI will be converted to camelCase for uniformity. Attribute names sent to NMI will be converted to the appropriate hypen-case and param_case where appropriate. Additionally, some fields are aliased (e.g, postalCode => postal) to provide consistent access between the Three Step and Query APIs.

You can disable this completely by specifying transform: false in the configuration options.

Dispatched XML is generated by xmlbuilder.

Usage

Setup

const nmi = require('nmi-node');
nmi.configure({
  apiKey: 'your-key-here',
  username: 'your-username',
  password: 'your-password'
});

Transaction

// create a sale
nmi.transaction.create('sale', {
  amount: 2.99,
  redirectUrl: 'http://127.0.0.1/example',
  billing: {
    firstName: 'John',
    lastName: 'Doe'
  }
});

// execute a token
nmi.transaction.execute('the-token');

Handling Errors

try {
  let txn = await nmi.transaction.execute('some-token');

  // success!

} catch(err) {

  if(err.isNMI) {
    // payment or gateway error - see err.response
  } else {
    // connection or outside error
  }

}
0.0.18

5 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago