Skip to main content

Malawi SDK

eLipa V4 JS SDK

Hi, this is sample documentation to the eLipa V4 JS SDK. it is not complete and may contain bugs and issues.

Getting Started

URL.

<script src="https://www.mw.elipa.global/js_sdk/v1/mw-sdk-v1.js"></script>

The JS library is for web integrations and provides essential features of integrating with your client side.

Initialize

To use the elipa() function, follow these steps:

  1. Call the elipa() function, passing an object as a parameter.
elipa({
MERCHANT_ID: 'your-merchant-id'
});
My tip

Your Merchant ID is a unique identifier that you receive once you've completed the registration process.

start

To use the start() function, and pass and object of the parameters

  1. Call the start() function, passing an object as a parameter.
  let data = {
amount : 10,
email: "[email protected]",
oid: "orderid",
currency: "MWK",
country: "mw",
callback: function(response){
console.log("callback", response);
alert(response.response_text);
}
};
elipa({
MERCHANT_ID: 'your-merchant-id'
}).start(data);

Below is the list of parameters that can be included in the object to be passed in the start() function.

parameter/FieldFielddescriptionrequired
countryCountry parameterYES
amountThe transaction amount, expressed in the supported currencyYES
currencyThe currency in which the transaction should be made. This is the currency the amount is inYES
emailCustomer’s emailYES
oidis a unique transaction reference Maximum length is 40 charactersYES
callbackA JavaScript Function that will be executed when a payment event occurs. In case of success, this should make an extra request to verify the transactionYES
phone (optional)The customer's phone number, if available.NO

How to use the JS library

Pass the payment options above to the JS

Channels

Malawi

Airtel Money

Coming very soon: TNM mPamba, Visa, Mastercard, Amex and Union Pay

Step 1

Ensure you call

<script src="https://www.mw.elipa.global/js_sdk/v1/mw-sdk-v1.js"></script>

tag at the head of your html page

Step 2

get the required parameters for example amount, email etc from your ecommerce or system and pass them to the start() function

Example

This is using a custom function called myFunction() to trigger the request to load the checkout page

<button onclick="myFunction()">Click me</button>
<script>
function myFunction(){
try {
let elipatwo = new elipa({MERCHANT_ID: "your-merchant-key"});
let data = {
amount : 10,
email: "[email protected]",
oid: "orderid",
currency: "MWK",
country: "mw",
callback: function(response){
console.log("callback pressed", response);
}
};
elipatwo.start(data);
}catch(err) {
console.log(err);
}
}
</script>

Step 3

Your Javascript callback function will receive an event upon payment or timeout. If the event contains a SUCCESS, therefore make a HTTP request to validate the details of the transaction before saving into your system

verify url

"to be shared"
NameDescType
vidaccount namestring
codetransaction reference received from JS callbackstring
hashhashed data of the posted datastring

A sample response

{
"status": 200,
"transaction_data": {
"vid": "demo",
"amount": "1900.00",
"receivingdatetime": "2019-12-09 17:40:56",
"tid": "demo",
"channel": "Airtel money",
"curr": "MWK",
"transaction_code": "CS_b464a5ee-f150-475",
"fname": "Chikondi",
"lname": "Banda",
"msisdn": "26512XXXXXXX"
}
}