Friday, 30 March 2018

Simple Payumoney Form in PHP

For Simple Payumoney Form in PHP

You need first payumoney merchant key and salt .
For integration you need to create 4 pages on your server.
1. fail.php
2.form_process.php
3.index.php
4.success.php


Test merchant key : rjQUPktU
Test salt : e5ilg1jwi8
Test Card No : 5123456789012346
Expiry - 05/2020
CVV - 123
Name - Test
Testing URL - https://test.payu.in/_payment
Producation URL - https://secure.payu.in/_payment

Just copy and paste code on your server and start collecting payment using payumoney.
Watch Payumoney integration simple form in PHP in video



Start Coding now:

1.fail.php

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<h2>Payment Failure</h2>
</div>

<div>
<?php 
if(isset($_POST['status'])){
if($_POST['status']=="failure"){
echo "<p>Payment Failed.<br>Details Are Below.</p>";
echo "<p>Failure Reason: ".$_POST['unmappedstatus']."</p>";
echo "<p>Txn Id: ".$_POST['txnid']."</p>";
echo "<p>Name: ".$_POST['firstname']."</p>";
echo "<p>Email: ".$_POST['email']."</p>";
echo "<p>Amount: ".$_POST['amount']."</p>";
echo "<p>Phone No: ".$_POST['phone']."</p>";
echo "<p>Product Info: ".$_POST['productinfo']."</p>";
}
}

?>
</div>
</body>

</html>


2.form_process.php

<?php 
if(!isset($_POST['firstname'])){header("location: index.php");}
// Change the Merchant key here as provided by Payumoney
$MERCHANT_KEY = "rjQUPktU";

// Change the Merchant Salt as provided by Payumoney
$SALT = "e5iIg1jwi8";


$firstname =$_POST['firstname'];
$email =$_POST['email'];
$phone =$_POST['phone'];
$productinfo =$_POST['productinfo'];
$service_provider =$_POST['service_provider'];
$amount =$_POST['amount'];
$txnid =$_POST['txnid'];
$productinfo =$_POST['productinfo'];
$surl =$_POST['surl'];
$furl =$_POST['furl'];


//$ =$_POST[''];

$hashseq=$MERCHANT_KEY.'|'.$txnid.'|'.$amount.'|'.$productinfo.'|'.$firstname.'|'.$email.'|||||||||||'.$SALT;
$hash =strtolower(hash("sha512", $hashseq)); 


?>


<!DOCTYPE html>
<html>
<head>

<title>Payment Processing</title>
<script>
    function submitForm() {
      var postForm = document.forms.postForm;
      postForm.submit();
    }
</script>
</head>
<body onload="submitForm();">

<div>
<h2>Payment Gateway Testing Sample</h2>
<table>
<tr><td>Transaction Id</td><td><strong><?php echo $_POST['txnid']; ?></strong></td><td>Amount: </td><td><strong>Rs. <?php echo $_POST['amount']; ?></strong></td>
</table>
<div >
<p>In this page we will genrate hash and send it to payumoney.</p>
<br>
<p>Please be patient. this process might take some time,<br />please do not hit refresh or browser back button or close this window</p>
</div>
</div>

<div>for live payment change https://test.payu.in/_payment to https://secure.payu.in/_payment


<form name="postForm" action="https://test.payu.in/_payment" method="POST" >
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash;  ?>"/>
<input type="hidden" name="txnid" value="<?php echo $_POST['txnid'];  ?>" />
<input type="hidden" name="amount" value="<?php echo $_POST['amount'];  ?>" />
<input type="hidden" name="firstname" value="<?php echo $_POST['firstname'];  ?>" />
<input type="hidden" name="email" value="<?php echo $_POST['email'];  ?>" />
<input type="hidden" name="phone" value="<?php echo $_POST['phone'];  ?>" />
<input type="hidden" name="productinfo" value="<?php echo $_POST['productinfo'];  ?>" />
<input type="hidden" name="service_provider" value="payu_paisa" size="64" />
<input type="hidden" name="surl" value="<?php echo $_POST['surl'];  ?>" />
<input type="hidden" name="furl" value="<?php echo $_POST['furl'];  ?>" />
</form>
</div>
</body>

</html>

3.index.php

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<h2>Payment Gateway Testing Sample</h2>
<h3>Fill the form and submit it for starting the transaction...</h3>
</div>

<div>
<table>
<form name="postForm" action="form_process.php" method="POST" >
<tr><td>txnid</td><td><input type="text" name="txnid" value="<?php echo $txnid=time().rand(1000,99999); ?>" /></td></tr>
<tr><td>amount</td><td><input type="text" name="amount" value="" /></td></tr>
<tr><td>firstname</td><td><input type="text" name="firstname" value="" /></td></tr>
<tr><td>email</td><td><input type="text" name="email" value="<?php echo $emailAddr;?>" /></td></tr>
<tr><td>phone</td><td><input type="text" name="phone" value="" /></td></tr>
<tr><td>productinfo</td><td><input type="text" name="productinfo" value="" /></td></tr>
<tr><td>success url</td><td><input type="hidden" name="surl" value="http://yourdomain.com/success.php" size="64" /></td></tr>
<tr><td>failure url</td><td><input type="hidden" name="furl" value="http://yourdomain.com/fail.php" size="64" /></td></tr>
<tr><td><input type="submit" /></td><td><input type="reset" /></td></tr>
</form>
</table>
</div>
</body>

</html>

4.success.php

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<h2>Payment Success</h2>
</div>

<div>
<?php 
if(isset($_POST['status'])){
if($_POST['status']=="success"){
echo "<p><h3>Payment Done Successfully.Print This Details and Send To admin@yourdomain.com <br>Payment Details Are Below.</h3></p>";
echo "<p><h3>Txn Id: ".$_POST['txnid']."</h3></p>";
echo "<p><h3>Name: ".$_POST['firstname']."</h3></p>";
echo "<p><h3>Email: ".$_POST['email']."</h3></p>";
echo "<p><h3>Amount: ".$_POST['amount']."</h3></p>";
echo "<p><h3>Phone No: ".$_POST['phone']."</h3></p>";
echo "<p><h3>Product Info: ".$_POST['productinfo']."</h3></p>";
echo "<p><h3>encryptedPaymentId: ".$_POST['encryptedPaymentId']."</h3></p>";
}
}

?><br><h2><font color="red">
Thanks For Payment. After Payment Confirmation Your Service Activated.<br> If Your Service Not Activated in 12 Hours. Call : Your Phone No</font></h2>
</div>
</body>

</html>

Sunday, 25 March 2018

Youtube video iframe auto play

insert auto play youtube video in your web page 

insert your youtube video in your any webpage .just copy code and edit this code and save .your youtube video ready for your web page visitors
copy and paste
Code for autoplay video on web page :

<iframe width="560" height="315" src="http://www.youtube.com/embed/UcDPd80752A?autoplay=1" frameborder="0"allowfullscreen></iframe>

Code for simple Iframe on web page :
<iframe src="http://www.youtube.com/embed/UcDPd80752A" width="560" height="315"frameborder="0"allowfullscreen></iframe>

This youtube video url : http://www.youtube.com/watch?v=UcDPd80752A

if you want insert this then you need edit
http://www.youtube.com/embed/UcDPd80752A