Jump to content


This topic is now archived and is closed to further replies.


Bank connection for payment not working...Help please....

Recommended Posts

Hello All!!

I am in the final moments of a project I have been working on.  The most important item is to complete the connection to the bank for a customer to make a purchase.  The project I am working on has been to upgrade the client's website visually and in part add some features.  However, the payment portion of the site does not need to be upgraded...they want to continue using it.

Here's my problem:  I am using the same php code as the 'old' site.  However, the code doesn't seem to work in my newly designed page.  After a customer has added an item to the 'shopping cart' they can click 'checkout' and they will be directed to the 'checkout.php' page where they then click a link that opens up a small popup window that connects to the bank so that they can input their credit card information. 

Currently [i]my[/i] checkout.php page has the [b]exact[/b] same code as the [i]old[/i] checkout.php page.  The only difference (as far as I can tell) is the newly designed format (the new css style and images). 

Additionally, if I simply replace the [i]new[/i] checkout.php with the [i]old[/i] checkout.php everything works fine.  I don't have to change anything and it just works!

Is it possible that the css style is affecting PHP?  I'm going crazy trying to figure this out!!  Please Help!!

Thanks soo much in advance,


Share this post

Link to post
Share on other sites
I can't seem to post my code...and I'm using the 'code' tags as recommended...nor can I seem to attach a file...I'm not having a good day  :-[


Share this post

Link to post
Share on other sites
Perhaps it would help if I give you the website address to view the page in action:


I would hate for anyone to have to create an account to view the issue, but if you do I would greatly appreciate it.  Also here is my php code:

Above header info -
$selectedArray = $_SESSION['selectedArray'];

// Get the shipping costs
$query="select * from jandj_jandj.shipping limit 1";

$freeShippingThreshold = $column[0]; // Value after which shipping is free
$shippingCostPerItem =  $column[1];  // Shipping cost per book
$paymentType = '3'; // 3 = Credit, 1 - Cash, 2 - Check


<?php include("sha.php"); ?>


// Constants for the business
//$url_tpvv='http://wapdd.visa.es/sis/realizarPago ';
$clave='blahblahblahblah';  // Ds_MerchantSignature
$name='J and J Books and Coffee';
$code='blahblahblah';  // ds_merchantCode
$terminal='1';  // 1 - Euros 3 - dollars

// Create order number 1 larger than largest order number in database
$query="select MAX(referenceNum) as ID from jandj_jandj.sales";
$orderNum=$column[0]+1; // Make the new order number 1 larger than the largest reference number on file

$language='2'; // Ds_Merchant_ConsumerLanguage    2 - English  (1 - Spanish)
$currency='978'; //  978 = Euros, (840 = dollars)

$responseURL='http://www.jandjbooksandcoffee.net/paymentdenied2.php'; // makes no difference


In the body -

// Display main message
    // echo'<p>'.$message.'</p><p>&nbsp;</p>';

// Get the information on the selected book from the database
$total = '0';

if (count($selectedArray) > 0) { // If the shopping cart is not empty...
foreach ($selectedArray as $value) {      // For each book id in the shopping cart...
// Get the book information
$query="select * from jandj_jandj.books where id=".$value." and display='JJ' limit 1";

$align = $left;


// Display the information of the selected book
echo '<div id="book"> <p><font color="#006633" face="Geneva, Arial, Helvetica, sans-serif"><b>';
echo $title;
echo '<br></b></font>
<b><font color="#000000" size="1" face="Geneva, Arial, Helvetica, sans-serif">
by '.$author.'
<b><font color="#FF0000" size="2" face="Geneva, Arial, Helvetica, sans-serif">
J &amp; J price: '.$priceAct.' &#8364;


// Display the Subtotal
echo '<p><font color="#00FF00"><b> Subtotal: '.number_format($total,2).' &#8364</b></font><br><br>';

// Check to see if buyer qualifies for free shipping
if ($total> $freeShippingThreshold) {
$shippingcost = '0';
} else {
$shippingcost = count($selectedArray) * $shippingCostPerItem;

// Display totals
echo '<font color="#00FF00"><b>Shipping Fees: '.number_format($shippingcost,2).' &#8364</b></font></p>';
$grandtotal = $total+$shippingcost;
echo '<p><font color="#00FF00"><b> Total: '.number_format($grandtotal,2).' &#8364</b></font><br><br>';

// Since the Caixa Cataluyna assumes that the last two digits are the decimals of the amount
// multiply the grand total by 100 to make the last two digits represent the decimal part
$amount = $grandtotal*100; 

} else {  // if count($selectedArray) > 0
// The shopping cart is empty
echo '<font color="#006633" face="Geneva, Arial, Helvetica, sans-serif"><b>';
echo "Your shopping cart is currently empty. <br><br>  ";
echo 'To add books to your shopping cart, go to the <a href="browse.php">Browse page</a> ';
echo 'and select some of our titles.<br><br>';
echo '</b></font><br>';

// Store the order number into the database so in case
// order is rejected for being a duplicate we don't end up
// using the same order number
$status= '1'; // 1 - placing the order
$_SESSION['sessionOrderNum'] = $orderNum;  // Track the order number for when we return from Caixa Cataluyna

$submit="insert into jandj_jandj.sales values ('','".$customerID."',NOW(),'".$grandtotal."','".$paymentType."','".$status."','".$orderNum."')";
// echo 'insert $result = '.$result.'<br>$submit='.$submit;
if ($result)
// New sales record was created. Move along
else {
echo 'A database error has occurred.  We were not able to generate a sales reference number for this transaction.
Please contact <a href="mailto:info@jandjbooksandcoffee.com">info@jandjbooksandcoffee.com</a> or <b>91 521 85 76</b> for assistance.';

echo 'To proceed with credit card authorization click on Charge to Credit.  You will be taken to
the Caixa Cataluyna credit authorization page.  Once the charge has been authorized or declined,
click on the <img src="images/close.gif" align="absmiddle"> button to proceed with the rest of the checkout procedure.
<b>It is very important that you use the <img src="images/close.gif" align="absmiddle"> button to proceed and not
close the window in any other fashion.  Otherwise the order may be delayed or cancelled.</b>';
echo '<br>';


<?php  // Submittal form
echo "<form name=compra action=$url_tpvv method=post target=tpv>

<input type=hidden name=Ds_Merchant_Amount value='$amount'>
<input type=hidden name=Ds_Merchant_Currency value='$currency'>
<input type=hidden name=Ds_Merchant_Order  value='$orderNum'>
<input type=hidden name=Ds_Merchant_MerchantCode value='$code'>
<input type=hidden name=Ds_Merchant_Terminal value='$terminal'>
<input type=hidden name=Ds_Merchant_ConsumerLanguage value='$language'>
<input type=hidden name=Ds_Merchant_MerchantURL value='$responseURL'>
// Compute hash to sign form data
// $signature=sha1_hex($amount,$orderNum,$code,$currency,$clave);
$sha = new SHA;
$message = $amount.$orderNum.$code.$currency.$clave;

$digest1 = $sha->hash_string($message);
$signature = strtoupper ($sha->hash_to_string( $digest1 ));

echo "<input type=hidden name=Ds_Merchant_MerchantSignature value='$signature'>

  <a href='javascript:calc()'>Charge to Credit <img src='images/tpvirtual.jpg' width='50' height='50' border='1' ALT='TPV Virtual'></a>




Share this post

Link to post
Share on other sites
Hi All,

I could really use some help with this problem.  Please let me know if I haven't given enough information, the topic is inappropriate for this particular forum, etc. 



Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.