instamojo payment gateway integration in php

Today, We want to share with you instamojo payment gateway integration in php.In this post we will show you instamojo integration in php, hear for Instamojo Payment Gateway Integration Tutorial in PHP we will give you demo and example for implement.In this post, we will learn about How To Integrate PayPal Payment Gateway In PHP? with an example.

instamojo php integration tutorial

Instamojo is an best online payment gateway,which allow user’s to Send, Receive Payments through many online options like net banking, Credit-Card, Debit Card etc. Instamojo very flexible to send as well as receive payments online.It is well secured and trusted payment gateway in india.

Instamojo supports 100% free payment gateway best plugins for WordPress, codeigniter, Opencart, PHP, Magento, Laravel, Drupal, NodeJS PrestaShop etc..

Instamojo Payment Gateway Integration Tutorial in PHP

  1. You Can receive payment only from india.
  2. we hope soon all over the world.
  3. For signup only PAN card and Indian Bank account need
  4. you can start with in 10 minutes.
  5. Receive money with in 3 days in your Any bank account.
  6. there is No setup fee.
Read Also:  How to Compare Date in SQL Server Query?

Step 1: Instamojo Sign Up

Sign Up with Instamojo. click here

Step 2: Get Instamojo Api-Key, Auth-Token and Salt

And then you set up an account with Instamojo, you will get an Api-Key, Auth-Token and Salt.
Click API & Setting menu as well as secure Api-Key, Auth-Token and Salt

Step 3: Create Instamojo form

Make form with below field
Submit form to pay.php

  • amount – The amount to be paid by the user’s.
  • phone – Phone number of the user’s.
  • buyer_name – user’s name.
  • purpose – Purpose of the payment.
  • email – Email address of the user’s.

Step 4: Dowload Instamojo Plugin

Make new file Pay.php
Include plugin folder src in Pay.php Dowload Plugin

<?php 
$product_name = $_POST["purpose"];
$price = $_POST["amount"];
$name = $_POST["buyer_name"];
$phone = $_POST["phone"];
$email = $_POST["email"];
include 'src/instamojo.php';       //free Download from website
$api = new Instamojo\Instamojo('*******YOU_PRIVATE_API_KEY******', '*****YOUR_PRIVATE_AUTH_TOKEN******','https://test.instamojo.com/api/1.1/');
try {
    $output_results = $api->paymentRequestCreate(array(
        "purpose" => $product_name,
        "amount" => $price,
        "buyer_name" => $name,
        "phone" => $phone,
        "send_email" => true,
        "send_sms" => true,
        "email" => $email,
        'allow_repeated_payments' => false,
        "redirect_url" => "http://www.pakainfo.COM/thankyou.php",
        "webhook" => "http://www.pakainfo.COM/webhook.php"
        ));
    //print_r($output_results);
    $pay_url = $output_results['longurl'];
    
    header("Location: $pay_url");
    exit();
}
catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}     
?>

Step 5: Thankyou Page redirected

payment success
and you Once got payment success done then it gets your redirected to thank you page (redirect_url).

"redirect_url" => "http://www.pakainfo.COM/thankyou.php"

Step 6: Print payment status

Thankyou.php
You can verify the payment status through webhook in Thankyou.php To print response from

<?php
include 'instamojo.php';
$api = new Instamojo\Instamojo('*******YOU_PRIVATE_API_KEY*****', '*****YOUR_PRIVATE_AUTH_TOKEN************','https://test.instamojo.com/api/1.1/');
$payid = $_GET["payment_request_id"];
try {
	$output_results = $api->paymentRequestStatus($payid);
	echo "<h4>Your Payment ID: " . $output_results['payments'][0]['payment_id'] . "</h4>" ;
	echo "<h4>Your Payment Name: " . $output_results['payments'][0]['buyer_name'] . "</h4>" ;
	echo "<h4>Your Payment Email: " . $output_results['payments'][0]['buyer_email'] . "</h4>" ;
	echo "<pre>";
	print_r($output_results);
}
catch (Exception $e) {
print('Error: ' . $e->getMessage());
}
?>

here you can use free to fill All the step by step understanding will be available in https://www.instamojo.com/developers/

I hope you get an idea about instamojo payment gateway integration.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.