View Full Version : PayPal Success page.
Scott Noyes
03-23-2009, 01:34 PM
I am having a problem with the success page at check out. I am using PayPal Express checkout. I run through PayPal fine I get to the confirm page and click the button to finalize the order. The order goes to PayPal I get a PayPal notice of the order and so does the customer. But on the success page there is no info about the order other than the item that was bought. Any ideas on what I should check?
Thanks
Ray Borduin
03-23-2009, 03:22 PM
The success page starts blank... You should be able to add all of that information from the stored session variables.
Scott Noyes
03-24-2009, 06:31 AM
Ray,
I understand that it needs to get the info from stored session variables. My problem is that I don't know why it is not pulling the information in.
Shouldn't the payer profile bindings load the payer info. and the order bindings load the order details? Do I need the order summary and order details server behaviors set up on this page?
Thanks
Scott
Ray Borduin
03-24-2009, 07:58 AM
Session variables should be available from all pages as well as shopping cart information. It should aready be in the bindings. You should not have to apply any server behaviors on this page.
Payer profile is often used to populate the checkout form. The checkout form submits to the confirm page and stores all of those values as session variables. Those session varialbles populate a hidden form that is used for the final transaction. In express checkout those fields are stored on the pp_confirm page from the payer profile passed back from paypal, but they are still stored as session variables. You should be able to refer to them directly on the success page.
Scott Noyes
03-24-2009, 08:53 AM
I have no clue where I am going wrong then. Can you see a problem in the code? I have stripped out some of the html code. The only thing that will display on the page is the session id, and the item info, and the tax. Shipping will not show, paypal payer info does not show.
<?php
//WA eCart Include
require_once("WA_eCart/CESmith_PHP.php");
?>
<?php
$CESmith->GetContent();
?>
<?php
require_once("WA_eCart/PP_ECO_Scripts/PP_ECO_PHP.php");
?>
<?php
$WA_PP_ECO_GetResult = WA_PP_ECO_SOAPObject();
if ((isset($_GET["token"]) && isset($_GET["PayerID"])) || (isset($_SESSION["PayPal_ECO_Token"]) && $_SESSION["PayPal_ECO_Token"] != "")) {
$WA_PP_ECO_GetResult = WA_PP_ECO_Get_Post("", "", false);
}
?>
<?php
if ($CESmith->IsEmpty()) {
$CESmith->redirStr = "http://www.cesmithco.com";
$CESmith->cartAction = "RedirectIfEmpty";
}
?>
<?php
// WA eCart Redirect
if ($CESmith->redirStr != "") {
header("Location: ".$CESmith->redirStr);
}
?>
<?php
$_SESSION['CESmith_UPS_Quote'] = "";
unset($_SESSION['CESmith_UPS_Quote']);
?>
<tr>
<td height="304" colspan="3" valign="top" bgcolor="#FFFFFF"> <div class="eC_Clean_Moab_Verdana">
<?php
//WA eCart Show If Start
if (!$CESmith->IsEmpty()) {
?>
<h2>Order Receipt</h2><h3 class="eCart_OrderHeaderInfo">Order number: <?php echo session_id(); ?></h3><p class="eCart_OrderHeaderInfo"></p>
<table class="eC_ShoppingCart" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>Name</th>
<th class="eC_PriceItem" >Price</th>
<th class="eC_FormItem" >Quantity</th>
<th class="eC_PriceItem" >Total</th>
</tr>
<?php
while (!$CESmith->EOF()) {
?>
<tr>
<td><img src="images/product/small/<?php echo $CESmith->DisplayInfo("Thumbnail"); ?>" alt="" width="110" height="110" class="eC_ProductThumb" />
<p class="eC_ItemLabel"><?php echo $CESmith->DisplayInfo("Name"); ?></p>
<p class="eC_ItemDescription"><?php echo $CESmith->DisplayInfo("Description"); ?></p></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->DisplayInfo("Price")); ?></td>
<td class="eC_FormItem" ><?php echo $CESmith->DisplayInfo("Quantity"); ?></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->DisplayInfo("TotalPrice")); ?></td>
</tr>
<?php
$CESmith->MoveNext();
}
$CESmith->MoveFirst();
?>
</table>
<div class="eC_OrderSummary">
<table border="0" cellpadding="0" cellspacing="0" class="eC_CartSummary">
<?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetDiscounts() > 0 || $CESmith->GetCharges() > 0 || $CESmith->GetShipping() > 0 || $CESmith->GetTax() > 0) {
?>
<tr>
<td class="eC_Subtotal eC_SummaryLabel">Sub-total</td>
<td class="eC_Subtotal"><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->TotalColumn("TotalPrice")); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="CESmith"
}
?>
<?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetDiscounts() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Discounts</td>
<td>-<?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->GetDiscounts()); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="CESmith"
}
?><?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetCharges() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Charges</td>
<td><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->GetCharges()); ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="CESmith"
}
?><?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetShipping() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Shipping</td>
<td><p> </p>
<p> </p></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="CESmith"
}
?><?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetTax() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Tax</td>
<td><?php echo((isset($_POST["tax"]))?$_POST["tax"]:"") ?></td>
</tr>
<?php
//WA eCart Merchandizing Show End
//ecart="CESmith"
}
?>
<tr class="eC_SummaryFooter">
<td class="eC_SummaryLabel">Total:</td>
<td><?php echo((isset($_POST["mc_gross"]))?$_POST["mc_gross"]:"") ?><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->GrandTotal()); ?></td>
</tr>
</table>
</div>
<?php
//WA eCart Show If Middle
}
else {
?><table><tr><td>The cart is empty</td></tr></table><?php
//WA eCart Show If End
}
?>
<div class="eC_PurchaserInfoWrapper">
<h3 class="eC_InfoHeader" >PayPal Express Checkout Information</h3>
<div class="eC_InfoContainer" >
<p class="eC_OrderInfo"> <strong class="eC_OrderInfoLabel">PayPal account Name:</strong><?php echo((isset($_POST["address_name"]))?$_POST["address_name"]:"") ?><?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "FirstName"); ?> <?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "LastName"); ?></p>
<p class="eC_OrderInfo"> <strong class="eC_OrderInfoLabel">PayPal account email:</strong><?php echo((isset($_POST["payer_id"]))?$_POST["payer_id"]:"") ?> <?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "PayerID"); ?></p>
</div>
<h3 class="eC_InfoHeader">Shipping Information</h3>
<div class="eC_InfoContainer">
<p class="eC_OrderInfo"><?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "Name"); ?><br />
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "Street1"); ?><br />
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "Street2"); ?><br />
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "CityName"); ?>, <?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "StateOrProvince"); ?> <?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "PostalCode"); ?><br />
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "Country"); ?></p>
</div>
</div>
</div></td>
</tr>
Thanks
Ray Borduin
03-24-2009, 09:36 AM
You are referring to:
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "LastName"); ?>
and not the associated session variable.... you should be adding session variable references to this page, not references to the paypal api.
Scott Noyes
03-24-2009, 11:06 AM
I guess that is my problem. I don't know how to add the session variable to this page. Can you give me an example.
It still does not explain why it is not showing the grand total for the order or the shipping charge.
Thanks Ray
Ray Borduin
03-24-2009, 02:54 PM
For instance... instead of:
<?php echo WA_PP_ECO_GetValue($WA_PP_ECO_GetResult, "LastName"); ?>
It should be:
<?php echo $_SESSION["eCartCheckoutForm_lastname"]; ?>
Instead of:
<?php echo((isset($_POST["tax"]))?$_POST["tax"]:"") ?>
it should be:
<?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->GetTax()); ?>
You can't refer to $_POST or WA_PP_ECO_GetValue on the success page. You need to refer to the cart or session directly.
Scott Noyes
03-25-2009, 11:55 AM
Ray,
Thanks for the help on this. For some reason it will not show the shipping costs. It is in the data base and it shows on the confirm page. Just not on the success page. here is the code
<?php
//WA eCart Merchandizing Show Start
//ecart="CESmith"
if ($CESmith->GetShipping() > 0) {
?>
<tr>
<td class="eC_SummaryLabel">Shipping</td>
<td><?php echo WA_eCart_DisplayMoney($CESmith, $CESmith->GetShipping()); ?></td>
</tr>
<?php
Ray Borduin
03-25-2009, 02:47 PM
It is possible that the shipping value is somehow reset. That code appears as though it should work unless the cart was cleared or a session variable that was used is reset.
Scott Noyes
03-26-2009, 06:00 AM
The shipping value still shows in the database for that session ID. The cart items, the tax, the order receipt number and with code to showed me all the Payer Info from PayPal shows. Baffled as to why the shipping will not show. The session does not reset until after you leave the success page. So I wouldn't think that just the shipping cost would be reset.
Ray Borduin
03-26-2009, 07:39 AM
I think you need to do some debugging. Display it several places during the checkout process... maybe it is updated at the last minute before checkout and that is why it is not set when you get to the success page. What is the trigger you are using for the shipping calculation on the confirm page?
Scott Noyes
03-26-2009, 08:11 AM
The shipping is calculated using UPS shipping. It brings the shipping costs to the cart fine. From there I use PayPal Express checkout. button takes me to PayPal. can do all that needs to be done on the PayPal site. click confirm PayPal sends it back to my confirm page. Shipping is displayed correctly using the same code that is on the success page. I use the Process transaction with PayPal express checkout. Use checkout button as the trigger. Order is processed correctly with the shipping costs. Success page is only place it will not show the shipping costs.
Scott Noyes
03-26-2009, 01:12 PM
I found the problem.
This little bit of code on the success page.
<?php
$_SESSION['CESmith_UPS_Quote'] = "";
unset($_SESSION['CESmith_UPS_Quote']);
?>
was resetting the shipping
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.