Your Cart

Integration of esewa into website, documentation to integrate esewa, sandbox of esewa

Integration of esewa into website, documentation to integrate esewa, sandbox of esewa
New Free
Integration of esewa into website, documentation to integrate esewa, sandbox of esewa
Ex Tax:$0.00
  • Stock: In Stock
  • Model: MOD_25
  • Weight: 0.00kg

I am working on Stylish Nepal and according to their requirement we have to integrate the esewa payment module but i did not find out easy documentation of esewa so i thought to make one. I am making one developer sandbox section and live version documentation.

:: The Flow of the esewa payment system

When customer chooses esewa as on-line payment option from merchant site, then s/he(user) is temporarily redirected to eSewa, where user have to login and confirm the transaction to proceed. After successful transaction in esewa, the user is redirected back to merchant site(success page). If transaction fails due to any reason, the user is informed by failure message and redirected back to merchant site(failure page).

For every successful transaction by user, the merchant account is credited accordingly and notified via email about transaction with details.

:: Integrating eSewa epay feature into merchant site

When user chooses esewa as on-line payment, the merchant site calls following URL with nine different parameters

URL : (For TEST environment) -

          (For LIVE environment) -

    Parameters :
    a) amt       - Amount(NRs) of the product/item which user have selected from merchant site for purchase/order.

    b) txAmt     - Tax amount(NRs) on the selected product/item.

    c) psc        - Product service charge, or service charge.

    d) pdc        - Product delivery charge, amount to be charge in case product/item have to be home delivered or so.

    e) tAmt        - Total amount(NRs), it is the final price after sum of base price, tax, and other charges.
              Eg : tAmt = amt + txAmt + psc + pdc  esewa will provide merchant with a code/id that will represent the merchant during transaction.

              For TEST, merchant can use "testmerchant" as merchant code.
              For LIVE, please contact esewa management to receive the code.

    g)pid        - Product ID, a unique id/code that represents the item.
              Eg : 121234 or MER121234 or soon

    h)su         - Success URL, a url to redirect after successful transaction in esewa. The merchant will recieve three different parameters as query string.
              Eg :
                oid = pid (sent by merchant)
                amt = total amount (tAmt)
                refId = unique Id send by eSewa.

    i)fu        - Failure URL, a url to redirect after failed transaction in esewa & with no parameters as query string.

    NOTE ::  i.  All parameters are of type String.
         ii. Parameters (amt, tAmt, scd, pid, su & fu) are required/mandatory.
         iii.Parameters (txAmt, psc, pdc value should be '0' if not required by merchant)

2) Sample code for integration of esewa into merchant site

   -- Written in HTML, refer this as source and develop your application accordingly --

   -- Code start --

    <form action = "" method="POST">
        <input value="100" name="tAmt" type=" hidden">
            <input value="90" name="amt" type="hidden">
            <input value="10" name="txAmt" type="hidden">
            <input value="0" name="psc" type="hidden">
            <input value="0" name="pdc" type="hidden">
            <input value="testmerchant" name="scd" type="hidden”>
            <input value="121234" name="pid" type=" hidden”>
            <input value=",html?q=su" type="hidden" name="su">
            <input value="" type="hidden" name="fu">
        <input value="Submit" type="submit">

    -- Code end --

3) Merchant can verify the every transaction(s) occurred through eSewa using our verification method.

:: How to ?
    As already stated, for every successful transaction by users from eSewa, they are redirect to merchant success page with query string containing parameters,         namely : 
    " oid, amt & refId "
    Store these parameters value, and send a request to given url with following parameters : (Verification process should be automated behind the scene, unknown to     user)

    URL :  For test : ""    
           For Live : ""
    Parameters     Description
    m    :    set value to "ver", always!
    amt     :     transaction amount 
    pid    :     product id (oid you received or pid merchant send to eSewa for transaction)
    rid     :     reference id (refId received by merchant after successful transaction)
    scd     :     merchant code that esewa provides  

    Sample code :
    <form action = "" method="POST">
               <input type="hidden" value="ver" name="m"/>
            <input type="hidden" value="testmerchant" name="scd"/>
            <input type="hidden" value="121234" name="pid"/>
            <input type="hidden" value="100" name="amt">
            <input type="hidden" value="12345" name="rid">
            <input value="Verify" type="submit">

P.S :: For further technical help please contact F1Soft International.

Write a review

Please login or register to review