Note: From V1.0.0, this Package can only be Used with node version18.x.x

View Documentation**

Esewa

Documentation

Importing Esewa Payment Method

Import by using import or require.

import { EsewaPayment } from "@bisham/payment-package";

Initialization With Default Values

// Initializes Esewa with default credentials

// Default Options

// runtimeMode = "Development"
// merchantId = "EPAYTEST"
// successRedirectUrl = "<https://example.com/esewaSuccessRedirect>"
// failureRedirectUrl = "<https://example.com/esewaFailureRedirect>"
// logConfig = false

const esewaPayment = new EsewaPayment();

Make Payment With Initial Config

// Payment Initiation Can Only Be Done in Browser Environment
esewaPayment.initiate({
      amount: 10, // Amount in Rs
			// Add A unique process-id 
      processId: 'Unique-id-for-each-transaction',
      totalAmount: 10
    })

Esewa Credentials (Development Mode Only)

eSewa ID : 9806800001, 9806800002, 9806800003, 9806800004, 9806800005

Password : Nepal@123

Transaction Token: 123456

Verifying Payment

// Validation Only Works on Server Side due To CORS
async function validatePayment () {
  const response = await esewaPayment.verifyPayment({
    amount: 10,
		// processId is oid recieved from eSewa
    processId: 'Unique-id-for-each-transaction',
    referenceId: '00063JQ'
  })
  // Implement Your Logic Here
  console.log(response?.success)
}

validatePayment()