7

I'm trying to integrate paypal express checkout on my website. I was trying to check using sandbox. When I submit data from my site token is generated with no error but when redirected to paypal it's not showing payment amount. btw I'm using the code from paypal express checkout wizard. It will be helpful if some one points me to correct direction.

require_once ("paypalfunctions.php");

$paymentAmount = 15;

$currencyCodeType = "GBP";
$paymentType = "Sale";
$returnURL = "http://www.mysite.com/paypal/confirm.php";
$cancelURL = "http://www.mysite.com/paypal/index.php";
$resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType,            $paymentType, $returnURL, $cancelURL);
$ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS")
{
RedirectToPayPal ( $resArray["TOKEN"] );

} 
shoieb0101
  • 71
  • 1
  • 3
  • Would also be helpful if you posted some code snippets ;) – Jonnix Sep 27 '11 at 16:58
  • Can you put all that in your question, and formatted please. – Jonnix Sep 27 '11 at 17:07
  • To be honest, I can't see anything wrong with the code you've posted. You may well have to start debugging the paypalfunctions.php file itself. – Jonnix Sep 27 '11 at 17:25
  • paypalfunctions.php is provided by paypal. I've checked the variable values and function parameters properly but couldn't find an answer..:( – shoieb0101 Sep 27 '11 at 17:33
  • "but when redirected to paypal it's not showing payment amount. " could you please be more specific? Are you receiving an error message? What is the API error code you receive? Is page content the error? Express Checkout shows *very little* on the PayPal hosted checkout pages by default. Can you explain your problem more thoroughly? – SgtPooki Sep 27 '11 at 18:46
  • I'm not receiving any error message. Token number is generated correctly. Here is sample generated url :https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=EC-5K726646V7217262E. But when user is redirected to order details page its not showing payment amount. – shoieb0101 Sep 28 '11 at 09:16

1 Answers1

17

As you're not passing so called 'line item details' (product data), PayPal doesn't display the total amount.

If you only want to show the amount for the current purchase, redirect buyers to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxxx&useraction=commit (instead of https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxxx)

If you want to start sending line-item details to PayPal, include the following in your SetExpressCheckout API request:

// Total amount of the purchase, incl shipping, tax, etc  
PAYMENTREQUEST_0_AMT=300.0  
// Total amount of items purchased, excl shipping, tax, etc     
PAYMENTREQUEST_0_ITEMAMT=300.0  
// Authorize the funds first (Authorization), or capture immediately (Sale)?    
PAYMENTREQUEST_0_PAYMENTACTION=Sale  
// First item  
L_PAYMENTREQUEST_0_NAME0=Item1  
L_PAYMENTREQUEST_0_QTY0=1  
L_PAYMENTREQUEST_0_AMT0=100.00  
// Second item  
L_PAYMENTREQUEST_0_NAME1=Item2  
L_PAYMENTREQUEST_0_QTY1=1  
L_PAYMENTREQUEST_0_AMT1=200.00 

If you want to see this in your own history as well, you'll also need to include this in DoExpressCheckoutPayment.

Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66
Robert
  • 19,326
  • 3
  • 58
  • 59
  • 1
    There may be an API version restrictions - see [this comment](http://stackoverflow.com/questions/8206175/missing-amount-and-order-summary-in-paypal-express-checkout#comment16499025_8213842) – Trent Sep 06 '12 at 10:45