how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php
how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php how to integrate cashfree payment gateway in php
//// main page
<form id="redirectForm" method="post" action="request.php">
<div class="form-group">
<input class="form-control" name="appId" type="hidden" value="appid your" />
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="orderId" value="<?php echo $uniqueId;?>" />
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="orderAmount" placeholder="Enter Amount" value="<?php echo $total_amount; ?>">
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="orderCurrency" value="INR" placeholder="Enter Currency here (Ex. INR)" />
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="orderNote" value="online payment" placeholder="Enter Order Note here (Ex. Test order)"/>
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="customerName" placeholder="Full Name" value="<?php echo $fetch_data['user_name']; ?>"/>
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="customerEmail" placeholder="Email " value="<?php echo $fetch_data['user_mail']; ?>"/>
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="customerPhone" placeholder="Phone Number" value="<?php echo $fetch_data['user_contact_no']; ?>"/>
</div>
<div class="form-group">
<input class="form-control" type="hidden" name="returnUrl" value="https://zixdo.com/online-payment-success.php"/>
</div>
<!--<div class="form-group">
<label>Notify URL:</label><br>
<input class="form-control" name="notifyUrl" placeholder="Enter the URL to get server notificaitons (Ex. www.example.com)"/>
</div>-->
<button type="submit" class="btn btn-primary btn-block" value="Pay" style="border-radius: 20px;">Make Payment</button>
<br>
<br>
</form>
</div>
<div class="col-md-2"></div>
//////// request.php
<!DOCTYPE html>
<html>
<head>
<title>Cashfree - Signature Generator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body onload="document.frm1.submit()">
<?php
$mode = "PROD"; //<------------ Change to TEST for test server, PROD for production
extract($_POST);
$secretKey = "your secret key";
$postData = array(
"appId" => $appId,
"orderId" => $orderId,
"orderAmount" => $orderAmount,
"orderCurrency" => $orderCurrency,
"orderNote" => $orderNote,
"customerName" => $customerName,
"customerPhone" => $customerPhone,
"customerEmail" => $customerEmail,
"returnUrl" => $returnUrl,
"notifyUrl" => $notifyUrl,
);
ksort($postData);
$signatureData = "";
foreach ($postData as $key => $value){
$signatureData .= $key.$value;
}
$signature = hash_hmac('sha256', $signatureData, $secretKey,true);
$signature = base64_encode($signature);
if ($mode == "PROD") {
$url = "https://www.cashfree.com/checkout/post/submit";
} else {
$url = "https://test.cashfree.com/billpay/checkout/post/submit";
}
?>
<form action="<?php echo $url; ?>" name="frm1" method="post">
<p>Please wait.......</p>
<input type="hidden" name="signature" value='<?php echo $signature; ?>'/>
<input type="hidden" name="orderNote" value='<?php echo $orderNote; ?>'/>
<input type="hidden" name="orderCurrency" value='<?php echo $orderCurrency; ?>'/>
<input type="hidden" name="customerName" value='<?php echo $customerName; ?>'/>
<input type="hidden" name="customerEmail" value='<?php echo $customerEmail; ?>'/>
<input type="hidden" name="customerPhone" value='<?php echo $customerPhone; ?>'/>
<input type="hidden" name="orderAmount" value='<?php echo $orderAmount; ?>'/>
<input type ="hidden" name="notifyUrl" value='<?php echo $notifyUrl; ?>'/>
<input type ="hidden" name="returnUrl" value='<?php echo $returnUrl; ?>'/>
<input type="hidden" name="appId" value='<?php echo $appId; ?>'/>
<input type="hidden" name="orderId" value='<?php echo $orderId; ?>'/>
</form>
</body>
</html>
///////////// online-payment-success.php
<?php
session_start();
include 'db_connect.php';
?>
<html>
<head>
<title>Pay Online</title>
<?php include("includes/include.php"); ?>
<link rel="stylesheet" href="css/rating.css">
</head>
<body>
<?php include("includes/header.php"); ?>
<section id="j-slider" class="about-us-banner">
<div class="animate-text">
<div class="single-slider" style="background-image:url(images/banner/banner7.jpg);" >
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 margin-top-100">
<h1>Pay Online</h1>
<!-- <p>We vaue your input, let us know how we're doing.</p> -->
</div>
</div>
</div>
</div>
</div>
</section>
<section class="section">
<h1 align="center">Payment Response</h1>
<?php
$secretkey = "your secret key";
$orderId = $_POST["orderId"];
$orderAmount = $_POST["orderAmount"];
$referenceId = $_POST["referenceId"];
$txStatus = $_POST["txStatus"];
$paymentMode = $_POST["paymentMode"];
$txMsg = $_POST["txMsg"];
$txTime = $_POST["txTime"];
$customerName=$_POST['customerName'];
$customerEmail=$_POST['customerEmail'];
$customerPhone=$_POST['customerPhone'];
$orderAmount=$_POST['orderAmount'];
$signature = $_POST["signature"];
?>
Comments
Post a Comment