0
votes

I am working on a site and I have a custom order form which displays a PayPal Express Checkout Button at the time of checkout. The button correctly redirects to PayPal in FireFox with the sale price and order number, however in Safari and Chrome, when I click on the button, nothing happens. Using Chrome Developer Tools, I can see that the GET request is being processed when I click the button, but then immediately canceled. I have already tried changing the form target to target="_self" and target="paypal" which did not help. Here is my code for the PayPal Express Checkout Button and the redirect to PayPal:

//////payment handlers
if ($payprovider == 'paypal') {
////hand off to paypal
header("Location: order-inspection.php?process=paypal&amount=".$row12['customer_payment_amount']."&items=".$row12['COUNT(session)']."&order=".$row12['ordernumber']." ");   
} elseif ($payprovider == 'googlewallet') {
////hand off to google
header("Location: order-inspection.php?process=googlewallet&amount=".$row12['customer_payment_amount']."&items=".$row12['COUNT(session)']."&order=".$row12['ordernumber']." ");
} elseif ($payprovider == 'wepay') {
////hand off to google
header("Location: order-inspection.php?do=wepay&amount=".$row12['customer_payment_amount']."&items=".$row12['COUNT(session)']."&order=".$row12['ordernumber']." ");
} elseif ($payprovider == 'callin') {
////hand off to google
header("Location: order-inspection.php?do=callin&amount=".$row12['customer_payment_amount']."&order=".$row12['ordernumber']."&id=".$_SESSION['CURINSPECID']." ");
} else {
////send to step one because inspectid dropped
header("Location: order-inspection.php?do=step1&error=sessiondropped");}

} elseif (isset($_GET['process']) && $_GET['process'] == 'paypal') {

////vars needed
$orderamount = cleanget('amount');
$orderitems = cleanget('items');
$ordernumberid = cleanget('order');
////update payment provider
$SQL1 = " UPDATE inspections_payment SET customer_payment_status='Dropped at Paypal',payment_provider = 'paypal' WHERE ordernumber = '".$ordernumberid."'";
$result1 = mysql_query($SQL1,$cid)or die(mysql_error());
////print the image to let customer know they are being redirected
print '<center><br /><br /><br /><br /><br /><strong>Sending you to PayPal for payment processing.</strong><br />Please wait.... </center>';
////data to send to paypal
print '<form name="payment" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="cbt" value="Return to site.">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="bn" value="IC_Sample">
<input type="hidden" name="on0" value="Order Number">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="os0" value="'.$ordernumberid.'">
<input type="hidden" name="custom" value="'.$ordernumberid.'">          
<input type="hidden" name="item_name" value="Lemon Squad - '.$orderitems.' Inspections Ordered" />
<input type="hidden" name="amount" value="'.$orderamount.'" />
<input type="hidden" name="return" value="http://www.lemonsquad.com/thankq.php">
<input type=hidden name="notify_url" value="http://www.lemonsquad.com/checking.php">
<input type="hidden" name="cancel_return" value="http://www.lemonsquad.com/order-inspection.php"/>
<input type="hidden" name="cpp_header_image" value="http://www.lemonsquad.com/images/paypalbanner.jpg"/>
</form>
<script type="text/javascript">
document.payment.submit();
</script>';

}




print '<form method="get" action="order-inspection.php" name="orderform1" id="orderform1" /><input type="hidden" name="process" value="final" /><input type="hidden" name="lsid" value="'.session_id().'" /><input type="hidden" name="paypro" value="paypal" />';
print '<a href="#" onClick="recordOutboundLink(this, \'Outbound Links\', \'paypal.com\');document[\'orderform1\'].submit();return false;"><img src="/images/paypal_checkout.png" /></a>';
print '<br /><br /></form>';
1

1 Answers

0
votes

May be a quick and dirty fix, but why not add a submit button to the form with something like: "Please click here if you are not redirected in 10 seconds" Does it submit then?