
Most of the people prefer online shopping which made eCommerce to grow rapidly. But, what makes an excellent eCommerce site for Customers and the answer is the easy and fast checkout process. Now a days there are several payment option available in the market today like – PayPal Checkout System, Paytm etc. But Today the payment gateway we gonna talk about is the fast and easy to use payment gateway which is Instamojo. So the first question is.
Demo Download Subscribe on Youtube
Note – There is an updated verion of Instamojo Payment gateway here. But this version still works.
What is Instamojo?
So Basically, Instamojo is an online payment gateway just like PayPal other payment gateway which allow user’s to Send, Receive Payments through many online options like net banking, Credit-Card, Debit Card etc. So using Instamojo it is easier to send and receive payments online.
Instamojo allow us to integrate the checkout system in the website, Apps etc for faster and easier checkout.
As well as instamojo is fully secured and trusted website in all over the World.
You Can receive payment from any place and Send payments to anywhere in the world.
This Project includes.
Integration of instamojo in our website using the API Provided by Instamojo.
So before we get started, there are the couple of things you have to do.
- Go to https://www.instamojo.com/ and create an account and fill in all the details they ask correctly to get your hands on their API.
- Go To https://test.instamojo.com/ for creating the account on the test/sandbox website to test out the API before getting your code online.
- then click on API & Plugins on the side bar and on the next page you will be provided with your Private key, Private Auth key, Private Salt.
- Just save those things.
NOTE : instamojo doesn’t allow localhost or 127.0.0.1 for testing their API so you need to have an online server, if you have one, cool enough and if you don’t have one the create one Here.
Instamojo has 2 different website
- For Live Production (i.e. When you are ready to upload it on your server and start your website.).
- For Testing purposes (i.e. When you are just testing the checkout system.).
Both of the website gives you
- Private API Key
- Private Auth Token
- Private Salt
And these Credentials are different for live and testing versions.
So let’s get started.
First of all you can see the demo to see the live working checkout system
Here are the checkout Details for demo. which you can use for checkout.
Card Number – 4242 4242 4242 4242
Expiry Date – 01/20
CVV – 111
Second Factor Authentication Code – 1221
First Open Webhook.php and see Line 20 and replace YOUR_PRIVATE_SALT to your private salt and on line 28 Change YOUR_EMAIL_ADDRESS to your Email id.
Now open Pay.php and see line no.11 and change YOU_PRIVATE_API_KEY & YOUR_PRIVATE_AUTH_TOKEN to your credentials. And on line 24,25 change your path.
And now Open thankyou.php and do the same on line 39.
And The rest files need no change but you can change it as per your need as per your Project Demand.
Right now the Codes are written for the Testing Version only but if you wanted to use it on live version then your just have to find
https://test.instamojo.com/api/1.1/ and Replace it with https://www.instamojo.com/api/1.1/payment-requests/ in every file.
If you need any Other Information About Instamojo API, You can check out their Documentations here – Instamojo Docs
So that’s it for this tutorial, hope you guys like it and if you did then share it out and subscribe to my blog for future updates Via email.
Thanks a lot for Reading.
Peace…
how to take payment amount from a form(according to form input) , upon submission and payment successful redirect to a page along with Mysql insertion of the form data (payment amount and two more fields)
it is meant to do that as it is already taking payment amount.just add the insert query in the callback page and save the data in the database by just making a sql connection.
I tried for the Live Payment, and I have changed the link to https://www.instamojo.com/api/1.1/payment-requests/ , I am getting Error as —> Error: null in my website. Please tell what to do?
plz input your salt in success.php page
Change https://www.instamojo.com/api/1.1/payment-requests/ URL to: https://www.instamojo.com/api/1.1/ in every file and also change Auth Key, AuthToken by opening src/Instamoho.php
When i run pay.php the follow error occure.
Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in D:\INETPUB\VHOSTS\rebirtheducation.com\rebirth\instamojo\pay.php on line 11
Parse error: syntax error, unexpected T_STRING in D:\INETPUB\VHOSTS\rebirtheducation.com\rebirth\instamojo\pay.php on line 11
send me a solution.
bro yanha kuch problem a rhe hai pehle mera system thik kam karra tha payment ka ab jab be test payment kar rah hu to not found ka error a raha ha i mere website me apki website me be same error a raha hai demo me plz help me kya karu yar plz help me
Check instamojo docs.
Thanks.
this is mysql query where i put it for storing data in database plz help me bro
$query =”insert into pay(firstname,amount,txnid,productinfo,email) values (‘$firstname’,’$amount’,’$txnid’,’$productinfo’,’$email’)”;
if(mysqli_query($con,$query)){
echo “thanks your data is saved on our database”;
Just put this where you get all the end result of a transaction.
I tried for the Live Payment, and I have changed the link to https://www.instamojo.com/api/1.1/payment-requests/ , I am getting Error as —> Error: null in my website. Please tell what to do?
Please check the new instamojo docs.
i am getting this error ‘ Load denied by X-Frame-Options: https://www.instamojo.com/@telnetservices/43c43d994c88436ebb8b81d4799f4471 does not permit cross-origin framing.’ can u know why?
And where you are giving this code ‘https://test.instamojo.com/@rahul13gangotri/’ for payment in this tutorial?
you should check out the documentation for this error.at instamojo docs, and I think that you might have not changes test to prod for live use.
I enter right auth Token But it is shows error.
Error: “Invalid Auth Token.”
The token on test.instamojo.com is different from instamojo.com’ live version, check which token you have passed.
after payment successful paymentid and status is getting but paid amount is not getting what i did wrong..?
code:
$cs=$_POST[‘custom_fields’];
echo $json = json_decode($cs, true);
echo $id= $json[‘Field_70990’][‘value’];
echo $main_balance = $json[‘Field_70990’][‘value’];
kindly help me,
regards,
Darshan N
If payment is successfull then the paid amount is the amount that is initiated. And it is there in the response see the demo link on the tutorial page.
code:
$cs=$_POST[‘custom_fields’];
echo $json = json_decode($cs, true);
echo $id= $json[‘Field_70990’][‘value’];
echo $main_balance = $json[‘Field_70990’][‘value’];
after payment successful paymentid and status is getting but paid amount is not getting what i did wrong..?
kindly help me,
regards,
Darshan N
we are working live and we changed link https://www.instamojo.com/api/1.1/payment-requests/ but we are getting error in pay.php -null
See this video for new and updated tutorial on instamojo payment gateway integration.
https://youtu.be/DxK8XW0JmBA