Instamojo is one of the best payment gateway of India helping more than 40,000+ businesses to accept payments online. Payment gateways are one of the most important ingredient in your website. Instamojo provides both live mode as well as test mode to test your payment gateway integration before it goes live. Its always advised to do test integration first and then change it to live mode. In this blog, we integrate the Instamojo payment gateway using ASP.NET MVC.
Before starting the blog, make sure you have an account of Instamojo. If you don’t have an account of Instamojo than don’t worry we already created a video tutorial of How to create an account in Instamojo for developers.
So, Hope you created an account in Instamojo.
How Instamojo Works?
Instamojo Payment gateway has a very straightforward way of accepting payments and getting paid. It is one of the easiest payment gateway available out there.
Integrating Instamojo is a simple 3 step process.
- Creating an order
- Show payment form to buyer on your website & receive payment
- Verify the payment and Redirect accordingly
1 . Creating an order
When users try to do a payment on your website. You have to create an order to do a payment. For creating order in Instamojo, there are some required details you have to provide for creating order and those are:-
- Name of the customer
- Contact Number
- Total Amount
- Transaction Id (will be a unique id which you have to create for every order)
- Redirect Url
Transaction Id will be a unique id which you have to create for every order to identify the order.
Redirect Url is used when the transaction is completed then the payment gateway will be redirected to that URL.
2 . Show payment form to buyer on your website & receive payment
After redirecting a customer to a payment page. He has to complete a payment or he can cancel the payment.
You can change the payment form, color, logo, and many more as you want using Instamojo panel.
3 . Verify the payment and Redirect accordingly
When customer is done with payment than user will be automatically redirected on given URL which you put in redirect_url tag at the time of creating the order.
Using this code you can validate the transaction status. Is it complete or failed.
If payment made successfully than you can redirect the user to a success page and show a success message or if payment failed than you can show a payment failed page and you can ask a user to do a transaction again.
So Using these 3 easy steps you can integrate the Instamojo payment gateway in Dot net MVC website.
If you don’t understand what’s going through in this blog or you got an error in code. You can watch Instamojo integration video tutorial which helps you. In this video i showed integration in easy way.
You can download the entire code for this tutorial using the link below. https://github.com/Shoury17/instamojo-csharpp