Integrate payhere Payment gateway in ASP.Net

on Oct 02, 2021 04:52 AM

I want to integrate Payment gateway to app.

how do it. I selected payhere payment gateway in lanka to do it.

This is there code.

    <form method="post" action="">
        <input type="hidden" name="merchant_id" value="121XXXX"> <!-- Replace your Merchant ID -->
        <input type="hidden" name="return_url" value="">
        <input type="hidden" name="cancel_url" value="">
        <input type="hidden" name="notify_url" value="">
        <br><br>Item Details<br>
        <input type="text" name="order_id" value="ItemNo12345">
        <input type="text" name="items" value="Door bell wireless"><br>
        <input type="text" name="currency" value="LKR">
        <input type="text" name="amount" value="1000">
        <br><br>Customer Details<br>
        <input type="text" name="first_name" value="Saman">
        <input type="text" name="last_name" value="Perera"><br>
        <input type="text" name="email" value="">
        <input type="text" name="phone" value="0771234567"><br>
        <input type="text" name="address" value="No.1, Galle Road">
        <input type="text" name="city" value="Colombo">
        <input type="hidden" name="country" value="Sri Lanka"><br><br>
        <input type="submit" value="Buy Now">



Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Oct 04, 2021 12:54 AM

Hi supun.d.kaduw...,

You can use PayHere with ASP.Net.

For payments you can use the PayHere Checkout API. It is just a simple HTML Form and Backend POST endpoint integration.

For your reference, the Checkout API documentation:

For more details refer below links.

return_url - This is the URL to where your user is redirected after successful payment. Should be a front end URL.

cancel_url - The user is redirected to this URL if the payment window is closed.

notify_url - After a successful payment, a POST request is sent to this URL. This is where you can get the full payment information. This should be a back end URL and should be publicly accessible.