I have integrated the Express Checkout to my website and it appears to be working fine with the code I got from the PayPal website.
However trying to modify it to make Paypal optional causes a strange problem.
The Payment amount does not seem to pass on to the page.
I have set up two versions of the same process.
http://coupons.exaget.com/paypal/expresscheckout.php?price=20 and http://coupons.exaget.com/paypal-sole/expresscheckout.php?price=20
The only difference between the two is two lines in paypalfunctions.php that are commented in the 1st site. This is shown below, where the last two lines are commented.
The prices (from the URL) is passed on correctly in the first case, but not in the second.
function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL)
{
//------------------------------------------------------------------------------------------------------------------------------------
// Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
$nvpstr="&PAYMENTREQUEST_0_AMT=". $paymentAmount;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
$nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
$nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
$nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
// $nvpstr = $nvpstr . "&SOLUTIONTYPE=" ."Sole"; //Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional.
// $nvpstr = $nvpstr . "&LANDINGPAGE=Billing"; //Type of PayPal page to display. It is one of the following values:Billing – Non-PayPal account
Whether or not you set SOLUTIONTYPE=Sole
shouldn't have anything to do with it.
Express Checkout will display the purchase amount to the buyer when one (or both) of the following is true:
PAYMENTREQUEST_0_ITEMAMT
, L_PAYMENTREQUEST_0_NAMEn
, L_PAYMENTREQUEST_0_AMTn
, L_PAYMENTREQUEST_0_QTYn
, etc.) In this case, the full line item details that you pass will be shown to the buyer.useraction=commit
in the URL when redirecting the buyer over to PayPal (e.g., https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=...&useraction=commit) In this case, the amount that you pass (PAYMENTREQUEST_0_AMT
) will be shown to the buyer. If you passed line item details, those will be shown to the buyer as well.