Integrate payhere Payment gateway in ASP.Net

supun.d.kaduwela
 
on Oct 02, 2021 04:52 AM
600 Views

I want to integrate Payment gateway to asp.net vb.net app.

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

This is there code.

<html>
<body>
    <form method="post" action="https://sandbox.payhere.lk/pay/checkout">
        <input type="hidden" name="merchant_id" value="121XXXX"> <!-- Replace your Merchant ID -->
        <input type="hidden" name="return_url" value="http://sample.com/return">
        <input type="hidden" name="cancel_url" value="http://sample.com/cancel">
        <input type="hidden" name="notify_url" value="http://sample.com/notify">
        <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="samanp@gmail.com">
        <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">
    </form>
</body>
</html>

 

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
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:
https://support.payhere.lk/api-&-mobile-sdk/payhere-checkout

For more details refer below links.

https://docplayer.net/41670165-Payhere-e-commerce-checkout-page.html

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.