eSewa Payment Gateway implementation in PHP


eSewa is the online payment gateway of Nepal which can be used for several purposed like making an online payment, paying utility bills, receiving money or setting up a merchant account. If you want to setup a ecommerce site and use eSewa as a payment option then here is a simple payment gateway implementation in PHP. This is just a sample. Of course you can take this as reference and make it more managed and organized. I have setup a demo site for this implementation in my site. You can find the whole source code at Github.
Sample form to be submitted to eSewa API:

<form action = "" method="POST">
<input value="100" name="tAmt" type="hidden">
<input value="90" name="amt" type="hidden">
<input value="5" name="txAmt" type="hidden">
<input value="2" name="psc" type="hidden">
<input value="3" name="pdc" type="hidden">
<input value="testmerchant" name="scd" type="hidden">
<input value="XYZ-1234" name="pid" type="hidden">
<input value="" type="hidden" name="su">
<input value="" type="hidden" name="fu">
<input value="Submit" type="submit">

See code at Github : Click here to see code

7 thoughts on “eSewa Payment Gateway implementation in PHP

  1. Hi, is there any step-by-step tutorial for someone who doesn't know php telling how to implement esewa in wordpress site?
    Thanks for your time.

  2. Helllo Guys!

    Its easy to get merchant code of eSewa.
    You can contact eSewa merchant team and ask for merchant code and step by step developers guide.
    They charge nominal amount for enrollment.

    Thank you,

Leave a Reply

Your email address will not be published. Required fields are marked *