JSPM

  • Created
  • Published
  • Downloads 204
  • Score
    100M100P100Q87681F
  • License MIT

Khalti checkout loader for web.

Package Exports

  • khalti-checkout-web

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (khalti-checkout-web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Introduction

Khalti checkout loader for browser.

Installation

Yarn

yarn add khalti-checkout-web

npm

npm install --save khalti-checkout-web

Usage

import KhaltiCheckout from "khalti-web";

let config = {
  "publicKey": "test_public_key_dc74e0fd57cb46cd93832aee0a507256",
  "productIdentity": "1234567890",
  "productName": "Drogon",
  "productUrl": "http://gameofthrones.com/buy/Dragons",
  "eventHandler": {
    onSuccess (payload) {
      // hit merchant api for initiating verfication
      console.log(payload);
    },
    // onError handler is optional
    onError (error) {
      // handle errors
      console.log(error);
    }
  },
  // one can set the order of payment options and also the payment options based on the order and items in the array
  paymentPreference: [
    "MOBILE_BANKING",
    "KHALTI",
    "EBANKING",
    "CONNECT_IPS",
    "SCT",
  ],
};

let checkout = new KhaltiCheckout(config);
let btn = document.getElementById("payment-button");
btn.onclick = function () {
    checkout.show({amount: 1000});
}

Please visit documentation site for details.