cordova-plugin-unionpay

1.2.2 • Public • Published

cordova-plugin-unionpay

Cordova plugin for Unionpay, supports iOS and Android.

Installation

# Official environment, Cordova
cordova plugin add https://github.com/Santino-Wu/cordova-plugin-unionpay.git --variable UNIONPAYMODE=00

# Develop environment, Cordova
cordova plugin add https://github.com/Santino-Wu/cordova-plugin-unionpay.git --variable UNIONPAYMODE=01

# Official environment, Ionic
ionic plugin add https://github.com/Santino-Wu/cordova-plugin-unionpay.git --variable UNIONPAYMODE=00

# Develop environment, Ionic
ionic plugin add https://github.com/Santino-Wu/cordova-plugin-unionpay.git --variable UNIONPAYMODE=01

The above parameter --variable UNIONPAYMODE=00 means invoking payment in official environment. If you don't have the permission for invoking payment in official environment, set variable UNIONPAYMODE as 01(which is develop mode) to invoke payment.

Usage

/**
 * @param {String} tn - The transaction number which fetched from Unionpay server
 * @param {Function} successFn - The callback function when payment was successful
 * @param {Function} failureFn - The callback function when payment was failed
 * @description
 * Requests payment with transaction number
 */
unionpay.pay(tn, successFn, failureFn);

Example

// Fetches transaction number from your server
var tn = '...';

window.unionpay.pay(tn, function (msg) {
    // Payment was successful, do something
    // ...
}, function (error) {
    // Payment was failed, do something
    // ...
});

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i cordova-plugin-unionpay

      Weekly Downloads

      6

      Version

      1.2.2

      License

      MIT

      Unpacked Size

      26.7 MB

      Total Files

      22

      Last publish

      Collaborators

      • wininsoft