AePS Gateway Integration (Web)

How to integrate AePS Gateway on your website to enable cashout services.

📘

LINKS


STEP 1: Download the JavaScript library

Run the following command in a terminal in your project folder:

npm install -S @ekoindia/aeps-gateway-lib
1. Download the script from here:

https://github.com/ekoindia/aeps-gateway-lib/blob/master/build/aeps-gateway-lib.js

2. Copy it into your project directory with the other scripts.

STEP 2: Include the library in your web-page

Copy the following code into your HTML body:

<script src="./node_modules/@ekoindia/aeps-gateway-lib.js"></script>

Note: You may have to change the './node_modules/' path depending on your project folder structure, or, if you have directly downloaded the script.

STEP 3: Configure AePS Gateway

Use the following code in your Javascript file or in your HTML page within the tags.

Note: Change all the values with your Eko Developer Account details

var aeps = new EkoAEPSGateway();

// Configure your developer API details...
aeps.config({
    "partner_name": "Your Company Name",
    "initiator_logo_url": "https://your-website.com/your-logo.png",
    "initiator_id": "9962981729",
    "developer_key": "becbbce45f79c6f5109f848acd540567",
    "secret_key": "y4aNr2cuSuaX2fCsfXMVopqvaZtx9MKHCcsF73fHxvc=",
    "secret_key_timestamp": "1585999782835",
    "user_code": "20810200",
    "language": "en",
    "environment": "uat" 
});

// Configure your callback URL for transaction-confirmation and for getting final result...
aeps.setCallbackURL('https://your-website.com/eko_aeps_callback');

📘

Configuration Parameters

  • initiator_id (required) - The unique cell number with which you are onboarded on Eko's platform
  • partner_name (required) - Your company/brand name.
  • developer_key (required) - Your unique API key that will authenticate your request.
    refer to authentication section
  • secret_key (required) - refer to authentication section. This parameter needs to be generated dynamically at your server and should be passed on the frontend at time of opening the gateway (For UAT and Prod both)
  • secret_key_timestamp (required) - refer to authentication section. This parameter needs to be generated dynamically at you server and should be passed on the frontend at time of opening the gateway (For UAT and Prod both).
  • user_code (required) - unique code of the retailer/ merchant availing AePS; this needs to be generated and activated while onboarding users (refer here).
  • initiator_logo_url (required) - Your company/brand logo to be shown on AePS Gateway.
  • language (optional) - Default language is English (en). For more languages, check the language-codes below.

❗️

Note:

  1. Make sure to generate and pass the valid dynamic secret-key and secret-key-timestamp and secret-key-timestamp must match the current time.
    2.On the production environment, make sure to pass the vaid name of your company and logo URL in the partner_name and initiator_logo_url and not any dummy value
  2. user_code must be activated for the AePS service otherwise you will get an error message when opening the AePS Gateway
  3. On production environment, ask you retailers/ merchants to complete their KYC (if activated on ICICI/Kotak AePS) from the AePS gateway iteself from the tab "complete your KYC" in order to do the transactions

Language

Code

English (Default)

en

Hindi

hi

Marathi

mr

Gujarati

gu

Kannada

kn

📘

Callback-URL Configuration

setCallbackURL(URL, {parameters, headers})

  • url - Your server's callback-URL for communicating with the Gateway. Must be HTTPS and accept POST-type requests.
  • options.parameters (optional) - Any custom parameters that you want to receive in the callback request. It is for your own use-case.
  • options.headers (optional) - Any custom headers that you want to receive in the callback request. It is for your own use-case. e.g. Authorization headers

🚧

Alternative of Callback URL

If you do not want to use callback URL for confirmation of transaction details, then you can register callback functions for transaction confirmation and transaction response details.

Sample code to set Callack functions
aeps.setConfirmationCallbackFunction(confirmFunc);
aeps.setResponseCallbackFunction(responseFunc);
// function that will be invoked for getting a transaction confirmation
function confirmFunc(data) {}
// function that will be invoked when a transaction is completed
function responseFunc(data) {}

Sample code to give confirmation to a transaction
aeps.confirmTransaction({
secret_key: "...",
secret_key_timestamp: "...",
request_hash: "..."
}

Sample code to reject a transaction
aeps.rejectTransaction(‘Reason for rejecting the transaction’);


STEP 4: Launch the AePS Gateway

  • Add a button on your page to launch the AePS Gateway
  • Upon click, call the open() function to launch the Gateway.
aeps.open();

STEP 5: Backend Integration

Now you need to do the backend integration for the AePS. Refer to AePS Backend Integration