PayPal payment integration code with auto return URL in sandbox mode

Here we are elaborate steps needed in PayPal payment integration with auto return URL in sandbox mode

>>> step one

we need a PayPal form with field values like amount , invoice, currency_code and action “https://www.sandbox.paypal.com/cgi-bin/webscr”

See below code
paypal payment form with auto return URL
( copy below code and save )

<div class="row spo space_top_10" style=" margin: auto;width: 24%;margin-top: 6%;">
 <h1>subscribe now </h1>
 <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
 <input type="hidden" value="_xclick" name="cmd">
 <input type="hidden" value="[email protected]" name="business">
 
 <input type="hidden" value="Order for subscribtion" name="item_name">
 <input type="hidden" value="NA" name="item_number">
 <input type="hidden" value="4" name="amount">
 <input type="hidden" value="1234567890" name="invoice">
 <input type="hidden" value="0" name="discount_amount"> 
 <input type="hidden" value="0" name="no_shipping">
 <input type="hidden" value="No comments" name="cn">
 <input type="hidden" value="USD" name="currency_code">
 <input type="hidden" value="https://www.tutorialshore.com/paypal/paypal.php" name="return">
 <input type="hidden" value="2" name="rm"> 
 
 <input type="hidden" value="US" name="lc">
 <input type="hidden" value="PP-BuyNowBF" name="bn">
 <input type="text" value="4 USD" name="amount2">
 <input type="submit" value="Pay by paypal" name="finalizeOrder" id="finalizeOrder" class="submitButton paypal_button">
</form>
</div>



>>>>> Step two

open below link and login with PayPal credential
https://developer.paypal.com/

Go to sandbox menu account and create bushiness account and personal account

store both personal and businesses sandbox credential and logout

>>>> Step three

Visit below link and login with sandbox businesses credential

https://www.sandbox.paypal.com/cgi-bin/webscr

Go to Account Settings as seen in the below picture

PayPal payment integration code with auto return URL in sandbox mode

Go to website payment as seen in the below picture

PayPal payment integration code with auto return URL in sandbox mode step 2

click Website preferences update options

PayPal payment integration code with auto return URL in sandbox mode step 3

start your payment test

https://www.tutorialshore.com/paypal/paypal.php

Moving WordPress website from one domain to another domain

Sometimes we need to move WordPress website from one domain to another domain, in this tutorial we will explain what are the main steps we have to do before moving WordPress website from one domain to another domain . so let have a look on it steps by step.suppose we move WordPress site from https://www.tutorialshore.com to http://percentagetool.com

Steps 1

Change wp_option table siteurl and home value

WordPress website from one domain to another domain

Step 2

Login to Admin side open Permalink Settings
Settings => Permalink Settings

Click Save Changes

WordPress website from one domain to another domain step2

How to add OTP validation in contact form 7 WordPress plugin

Among the WordPress developers their is always only one option in the case of which form plugin to use, that is contact contact form 7 WordPress plugin. as per the current report their a huge percentage of spam message every website are getting daily from the users, so OTP validation is most suitable solution to block spammers so automatically our question is how to add OTP validation in contact form 7 WordPress plugin

Let see in details

add below code inside admin contact form section see in details below

<div class="pad0 col-12 col-sm-12 col-md-12">[text* telno id:mobileOTP class:inpt_box placeholder "Contact Number"]</div>
<div class="pad0 col-12 col-sm-12 col-md-12">[text* OTP id:mobileOTPField class:inpt_box placeholder "OTP"]</div>
<div class="pad0 col-12 col-sm-12 col-md-12">[text OTPDEMO id:mobileOTPFieldDemo class:inpt_box placeholder "OTP"]</div>

after adding this page we have to work on script

download footer.php from theme folder
add below code top of the page


 <script>
jQuery(document).ready(function(){ 
jQuery("#mobileOTPField").css('display','none'); 
jQuery("#mobileOTPFieldDemo").css('display','none'); 
jQuery("#mobileOTPField_bottom").css('display','none'); 
jQuery("#mobileOTPFieldDemo_bottom").css('display','none'); 
var otp ; 
 jQuery("#mobileOTP").on("blur",function(){
 
 var mobile=jQuery("#mobileOTP").val();
 var name=jQuery("#yourname").val();
 if(mobile!='')
 {
 var otp=Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000;
 jQuery.post("/send_otp.php",
 {
 mobile: mobile,
 name: name,
 otp: otp
 },
 function(data, status){
 console.log("ffffffffff"+data);
 //alert(otp);
 jQuery("#mobileOTPField").css('display','block');
 jQuery("#mobileOTPFieldDemo").val(otp);
 
 } );
 }
});
jQuery("#mobileOTPField").on("click",function(){
jQuery("#mobileOTPField").css('border','0px solid red');
});
jQuery("#mobileOTPField").on("blur",function(){
jQuery("#mobileOTPField").css('border','0px solid red');
 var value_otp=jQuery("#mobileOTPFieldDemo").val();
 var otp=jQuery("#mobileOTPField").val();
 if(value_otp!=otp)
 {
 jQuery("#mobileOTPField").css('border','1px solid red');
jQuery("#mobileOTPField").val(''); 
 }

});
</script>

Finally upload below files(send_otp.php) in root folder

This is main functionality for OTP validation in contact form 7 WordPress plugin

<?php
$mobile_no=$_REQUEST['mobile'];
$name=$_REQUEST['name'];
if($name=='')
{
$name='User'; 
}
$otp=$_REQUEST['otp'];
//$otp=rand(100000, 999999);
$curl = curl_init();
$post_data='<MESSAGE>
 <AUTHKEY>278449AfqSEysssss6tW5cebts7e3c</AUTHKEY>
 <SENDER>TEST API</SENDER>
 <ROUTE>4</ROUTE>
 <CAMPAIGN>TEST API</CAMPAIGN>
 <COUNTRY>TEST Enquiry</COUNTRY>
 <SMS TEXT="Dear '.$name.', %0aPlease use this OTP '.$otp.' to complete your enquiry. %0a%0a-Team TESTOTP" >
 <ADDRESS TO="'.$mobile_no.'"></ADDRESS>
 </SMS>
</MESSAGE>';

curl_setopt_array($curl, array(
 CURLOPT_URL => "https://control.msg91.com/api/postsms.php",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 30,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS => $post_data,
 CURLOPT_SSL_VERIFYHOST => 0,
 CURLOPT_SSL_VERIFYPEER => 0,
 CURLOPT_HTTPHEADER => array(
 "content-type: application/xml"
 ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

return $otp;
?>