ESewaPayment constructor

ESewaPayment({
  1. required double amount,
  2. required String productName,
  3. required String productID,
  4. required String callBackURL,
})

ESewaPayment constructor takes 4 required arguments in order to complete payment process.

amount : Price of Product or Service

productName : Name of Product or Service

productID : Set a unique Id for your particular product or services

callBackURL : API exposed at merchant/client`server where eSewa sends a copy of proof of payment after successful payment

Implementation

// constructor
ESewaPayment(
    {required double amount,
    required String productName,
    required String productID,
    required String callBackURL}) {
  if (amount <= 0) {
    throw new Exception("Paying amount can not be negative figure or zero.");
  }

  this._productPrice = amount;
  this._productID = productID;
  this._productName = productName;
  this._callBackURL = callBackURL;
}