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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cordova-plugin-payengine-softpos

v1.0.1

Published

Cordova PayEngine SoftPOS Plugin

Downloads

62

Readme

cordova-plugin-payengine-softpos

Overview

cordova-plugin-payengine-softpos is a Cordova plugin that enables seamless integration of payment processing capabilities into mobile applications. This plugin provides a simple and efficient way to handle payments on both iOS and Android platforms.

Features

  • Cross-Platform Support: Compatible with both iOS and Android devices.
  • Easy Integration: Simple API for incorporating payment processing into your app.
  • Secure Transactions: Ensures secure handling of payment information.

Installation

To install the plugin, run the following command in your Cordova project directory:

cordova plugin add cordova-plugin-payengine-softpos

Usage

After installing the plugin, you can use it in your JavaScript code as follows:

This plugin includes type support. If you're using JavaScript, you can annotate it as follows:

/**
 * @type {import("cordova-plugin-payengine-softpos").PayEngineDevicePlugin}
 */
var PayEngineDevicePlugin = window.PayEngineDevicePlugin;

Initialize and Register Callbacks

/**
 * @param {import("cordova-plugin-payengine-softpos").EventData} params
 */
var callbackHandler = function (params) {
    console.log(JSON.stringify(params));
    if (typeof params === 'object') {
        var { method, error, transactionId, completed, activationCode: activeCode, terminalInfo } = params;
        switch (method) {
            case 'criticalError':
                alert(error);
                break;
            case 'onInitFailed':
            case 'onConnectionFailed':
                status.innerHTML = getErrorMessage(error);
                break;
            case 'onActivationRequired':
                isActivationRequired = true;
                activationCode = activeCode;
                status.innerHTML = "Please activate using this code: " + activationCode;
                break;
            case 'onActivationStarting':
                isActivationRequired = false;
                status.innerHTML = "Activating device...Merchant ID: " + terminalInfo.merchantId;
                break;
            case 'onActivationProgress':
                status.innerHTML = `Activating device... ${completed}%`;
                break;
            case 'onConnected':
                if (!isConnected) {
                    // Set ready
                    status.innerHTML = "Ready to process";
                    btnTransaction.classList.add('show');
                }
                break;
            case 'onTransactionCompleted':
                alert(`Transaction succeeded. Transaction ID: ${transactionId}`);
                break;
            case 'onTransactionFailed':
                alert(`Transaction failed. ${error}`);
                break;
        }
    }
}

var errorHandler = function (err) {
    alert(JSON.stringify(err))
}

document.addEventListener('deviceready', function() {
    // Initialize the payment engine
    PayEngineDevicePlugin.initialize({
      environment: 'sandbox', // Options: sandbox | production
      merchantId: '<YOUR-MERCHANT-ID>', // Optional; omit to allow manual registration in the merchant portal
      mode: PayEngineDevicePlugin.transactionModes.DEVICE // Optional; controls transaction initiation mode. DEVICE = app only, COMPANION = terminal (API) only, FULL = both terminal and app
    }, callbackHandler, errorHandler);
});

Maintain the Connection

To ensure reliable device connectivity, implement these event listeners in your app:

// Handle app resume
document.addEventListener('resume', function() {
    if (initialized) {
        PayEngineDevicePlugin.connect()
            .then(() => {
                console.log('Device connection restored');
            })
            .catch(error => {
                console.error('Failed to restore device connection:', error);
            });
    }
}, false);

For optimal connection management, you should:

  • Reconnect when the app resumes from background
  • Monitor connection state through the callback handler

Making a Payment

To make a payment, use the following method:

PayEngineDevicePlugin.startTransaction({
  amount: 1.00,
  currencyCode: 'USD',
  transactionData: {
    data: {
        sales_tax: 0.50,
        order_number: '7874646254'
    }
  }
}, function() {
    console.log("Payment request successful");
}, function(error) {
    console.error("Payment request failed: ", error);
});

The transactionData property accepts all parameters from Sale API

License

Copyright (C) 2024 PayEngine. (https://www.payengine.co)