npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dadesystems/dademobile

v1.2.1

Published

JavaScript library for Dade Mobile API

Readme

DadeMobile.js

JavaScript library for Dade Mobile API. This library provides convenient access to the Dade Mobile API from applications written in JavaScript.

Sample App

Apache Cordova sample app demonstrating the use of DadeMobile.js: https://github.com/DadeSystems/CordovaSample

Installation

Install the package with npm:

npm install @dadesystems/dademobile --save

Or using yarn:

yarn add @dadesystems/dademobile

Usage

The general workflow for capturing payments is as follows:

  • Initialize DadeMobile with provided API Key and API URL.
  • Use instance of DadeMobile to stage, update, and confirm a payment.

Initialization

The first step is to initialize DadeMobile with provided API Key and API URL:

CommonJS:

const { DadeMobile } = require('@dadesystems/dademobile');

Or using ES modules:

import { DadeMobile } from '@dadesystems/dademobile';

Initialize

const dadeMobile = new DadeMobile(API_KEY, API_URL);

Stage Payment

After initialization, the next step is to stage a payment. The payment amount can be set when staging a payment, or after a payment has already been staged, depending on your workflow. If a payment was previously staged but not confirmed, then it will be resumed.

Params

  • external_user_id: Unique identifer for your user making the payment.
  • external_reference: (Optional) your reference for the payment.
  • amount: (Optional) payment amount. This can be set after staging the payment.

Example

dadeMobile
  .stagePayment({ 
    external_user_id: '123',
    external_reference: '321',
    amount: 5.00
  })
  .then((payment) => {
    // Payment successfully staged
  })
  .catch((error) => {
    // Failed to stage payment
  });

Set Amount

Set the amount of a staged payment.

Params

  • payment: The staged payment.
  • amount: Payment amount.

Example

dadeMobile
  .setAmount(payment, 15.00)
  .then((payment) => {
    // Payment amount updated successfully
  })
  .catch((error) => {
    // Failed to update payment amount
  });

Upload Image

Upload image for a staged payment.

Params

  • payment: The staged payment.
  • imageType: The type of image being uploaded (checkfront or checkrear).
  • encodedImage: Base64 encoding of the image data.

Example

dadeMobile
  .uploadImage(payment, 'checkfront', encodedImage)
  .then((payment) => {
    // Image uploaded successfully
  })
  .catch((error) => {
    // Failed to upload image
  });

Confirm Payment

Once a payment is staged and all properties have been set, the final step is to confirm the payment. If the payment fails validation, then validation errors will be returned. See the next section for error codes.

Params

  • payment: The staged payment.

Example

dadeMobile
  .confirmPayment(payment)
  .then((payment) => {
    // Payment confirmed successfully
  })
  .catch((error) => {
    // Failed to confirm payment
    // Handle validation errors if present
    const { errors } = error;
  });

Success Response

Example payment data returned upon successful confirmation of a payment:

{
  id: 1001,
  type: "Check Payment",
  status: "Completed",
  amount: 5.0,
  external_user_id: "123",
  external_reference: "321",
  date: "2019-02-12",
  check_routing_number: "123456789",
  check_account_number: "987654321",
  check_number: "2808"
}

Validation Errors

Validation errors are returned as an array of error objects containing the error code and error message, example:

[
  {
    error_code: 2001,
    error_message: 'Front image required'
  }
]

The following is a list of validation error codes and descriptions:

2000: Check amount required
2001: Check front image required
2002: Check rear image required
2003: Check image still processing
2004: Check IQA failed
2005: Check duplicate found
2006: Check amount mismatch

Check Amount Mismatch

When check read amount validation is enabled, and the amount set for the payment does not match the amount read from the check, a check amount mismatch validation error will be returned containing the amount read, example:

[
  {
    error_code: 2006,
    error_message: 'Check amount mismatch',
    error_data: {
      read_amount: 10.0
    }
  }
]

This can be resolved by updating the payment with the correct amount before resubmitting. If the amount was read incorrectly, you can ignore the amount mismatch when resubmitting, example:

dadeMobile
  .confirmPayment(payment, { 
    ignore_check_amount_mismatch: true 
  })

Using Promises

Every method returns a chainable promise:

dadeMobile
  .stagePayment({ 
    external_user_id: '123',
    external_reference: '321',
    amount: 5.00
  })
  .then((payment) => {
    return dadeMobile.setAmount(payment, 10.00);
  })
  .then((payment) => {
    return dadeMobile.uploadImage(payment, 'checkfront' encodedImage);
  })
  .then((payment) => {
    return dadeMobile.uploadImage(payment, 'checkrear' encodedImage);
  })
  .then((payment) => {
    return dadeMobile.confirmPayment(payment);
  })
  .then((payment) => {
    console.log(payment);
  })
  .catch((error) => {
    console.log(error);
  });