$value) { // create the md5 input and URL leaving out any fields that have no value if (strlen($value) > 0) { $md5HashData .= $value; } } // Create the secure hash and append it to the Virtual Payment Client Data if // the merchant secret has been provided. if (strlen($SECURE_SECRET) > 0) { $hashedvalue .= strtoupper(md5($md5HashData)); } }else if( $_POST['demo_radio'] == 'no') { //Transaction Through Paypal /******************************************** ReviewOrder.php This file is called after the user clicks on a button during the checkout process to use PayPal's Express Checkout. The user logs in to their PayPal account. This file is called twice. On the first pass, the code executes the if statement: if (! isset ($token)) The code collects transaction parameters from the form displayed by SetExpressCheckout.html then constructs and sends a SetExpressCheckout request string to the PayPal server. The paymentType variable becomes the PAYMENTACTION parameter of the request string. The RETURNURL parameter is set to this file; this is how ReviewOrder.php is called twice. On the second pass, the code executes the else statement. On the first pass, the buyer completed the authorization in their PayPal account; now the code gets the payer details by sending a GetExpressCheckoutDetails request to the PayPal server. Then the code calls GetExpressCheckoutDetails.php. Note: Be sure to check the value of PAYPAL_URL. The buyer is sent to this URL to authorize payment with their PayPal account. For testing purposes, this should be set to the PayPal sandbox. Called by SetExpressCheckout.html. Calls GetExpressCheckoutDetails.php, CallerService.php, and APIError.php. ********************************************/ require_once 'CallerService.php'; session_start(); /* An express checkout transaction starts with a token, that identifies to PayPal your transaction In this example, when the script sees a token, the script knows that the buyer has already authorized payment through paypal. If no token was found, the action is to send the buyer to PayPal to first authorize payment */ if(! isset($_REQUEST['token'])) { /* The servername and serverport tells PayPal where the buyer should be directed back to after authorizing payment. In this case, its the local webserver that is running this script Using the servername and serverport, the return URL is the first portion of the URL that buyers will return to after authorizing payment */ $serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; $url=dirname('https://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']); $currencyCodeType=$_REQUEST['currencyCodeType']; $paymentType=$_REQUEST['paymentType']; $personName = $_REQUEST['PERSONNAME']; $SHIPTOSTREET = $_REQUEST['SHIPTOSTREET']; $SHIPTOCITY = $_REQUEST['SHIPTOCITY']; $SHIPTOSTATE = $_REQUEST['SHIPTOSTATE']; $SHIPTOCOUNTRYCODE = $_REQUEST['SHIPTOCOUNTRYCODE']; $SHIPTOZIP = $_REQUEST['SHIPTOZIP']; $INVOICENUMBER = $_REQUEST['INVOICENUMBER']; $TOTALCOST = $_REQUEST['ITEMAMT']; $NVPSTRING = $_REQUEST['NVPSTRING']; $_SESSION['invoicenumber']=$_REQUEST['INVOICENUMBER']; /* The returnURL is the location where buyers return when a payment has been succesfully authorized. The cancelURL is the location buyers are sent to when they hit the cancel button during authorization of payment during the PayPal flow */ $returnURL =urlencode($url.'/ReviewOrder.php?currencyCodeType='.$currencyCodeType.'&paymentType='.$paymentType); $cancelURL =urlencode("$url/SetExpressCheckout.php?paymentType=$paymentType" ); /* Construct the parameter string that describes the PayPal payment the varialbes were set in the web form, and the resulting string is stored in $nvpstr */ $itemamt = 0.00; $itemamt = $TOTALCOST ; $amt = $itemamt; $maxamt= $amt+25.00; $nvpstr=""; $nvpstr=$NVPSTRING."&MAXAMT=".(string)$maxamt."&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt."&L_NUMBER0=".$INVOICENUMBER."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType."&PAYMENTACTION=".$paymentType; /* Make the call to PayPal to set the Express Checkout token If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. If an error occured, show the resulting errors */ $resArray=hash_call("SetExpressCheckout",$nvpstr); $_SESSION['reshash']=$resArray; $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS"){ // Redirect to paypal.com here $token = urldecode($resArray["TOKEN"]); $payPalURL = PAYPAL_URL.$token; header("Location: ".$payPalURL); } else { //Redirecting to APIError.php to display errors. $location = "APIError.php"; header("Location: $location"); } } else { /* At this point, the buyer has completed in authorizing payment at PayPal. The script will now call PayPal with the details of the authorization, incuding any shipping information of the buyer. Remember, the authorization is not a completed transaction at this state - the buyer still needs an additional step to finalize the transaction */ $token =urlencode( $_REQUEST['token']); /* Build a second API request to PayPal, using the token as the ID to get the details on the payment authorization */ $nvpstr="&TOKEN=".$token; /* Make the API call and store the results in an array. If the call was a success, show the authorization details, and provide an action to complete the payment. If failed, show the error */ $resArray=hash_call("GetExpressCheckoutDetails",$nvpstr); $_SESSION['reshash']=$resArray; $ack = strtoupper($resArray["ACK"]); if($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING'){ require_once "GetExpressCheckoutDetails.php"; } else { //Redirecting to APIError.php to display errors. $location = "APIError.php"; header("Location: $location"); } } } else if( $_POST['demo_radio'] == 'off' && $_POST['sNdMaIl'] == 'Send Mail!') { // include_once "sendMailForOfflinePayment.php"; //$invoiceNo=$_POST['vpc_OrderInfo']; include_once "connection.php"; include_once "Payment_Instruction.php"; ini_set("include_path", '../printTracker/PEAR/'); require_once "Mail.php"; require_once 'Mail/mime.php'; function sendOfflineInvoiceAndPaymentInstruction( $invoiceNumber ){ $invoice=$invoiceNumber; $sql = "SELECT * FROM email_queue WHERE success = 0 AND max_attempts != attempts AND InvoiceNumber='$invoice' " ; $result = mysql_query($sql); $host = "smtp.gmail.com"; $port = "587"; $username = $GmailUsername; $password = $GmailPassword; if (mysql_num_rows( $result )) { while ($queued_mail = mysql_fetch_array($result)) { $to = $queued_mail['to_email']; $cc = $MailIdForCc ; $recipients = $to.", ".$cc; $subject = $queued_mail['subject']; $bodyDB = $queued_mail['message']; $from = $queued_mail['from_email'] ; $country_name=$queued_mail['Country_Name'] ; $string_invoice=$queued_mail['InvoicePDF'] ; //$string_invoice=stripslashes($queued_mail['InvoicePDF']); //$to='govindgsingh@gmail.com'; //$from='knowgovind@gmail.com'; $mime = new Mail_Mime(); $body=$mime->setHtmlBody($bodyDB); $govind='Invoice'; $govind_1="Payment Instruction.pdf"; $string_payment=pdf_invoice($country_name); $mime->addAttachment($string_payment, 'application/pdf', $govind_1, false, 'base64'); $mime->addAttachment($string_invoice, 'application/pdf', $govind, false, 'base64'); //$body = $mime->get(); $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject, 'Cc'=> $cc, 'Reply-To' => $MailReplyTO ); $hdrs = $mime->headers($headers); $body = $mime->get(); $mail= &Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail->send($recipients, $hdrs, $body); if (PEAR::isError($mail)) { $sql = "UPDATE email_queue SET " . "attempts = attempts+1, " . "last_attempt = now()" . "WHERE id = '" . $queued_mail['id'] . "'"; mysql_query($sql); echo( $mail->getMessage() ); } else { $sql = "UPDATE email_queue SET " . "attempts = attempts+1, " . "success = '1', " . "last_attempt = now(), " . "date_sent = now() " . "WHERE id = '" . $queued_mail['id'] . "'"; mysql_query($sql); echo("Message successfully sent!"); } } } } sendOfflineInvoiceAndPaymentInstruction( $invoiceNo ) ; //sendOfflineInvoiceAndPaymentInstruction( 'G15V92' ) ; echo 'your details are being send'; //header("Location: cnfrm.php"); } else{ echo 'Error during payment'; } // FINISH TRANSACTION - Redirect the customers using the Digital Order // =================================================================== ?>

Please wait while your payment is being processed...Through Axis Bank

$value) { if (strlen($value) > 0) { ?>

Please wait while your payment is being processed...Through Paypal

Please wait while your details is send to your mail id...

Transaction failed !!!