NVP Problem

Hi Chaps,

I’m integrating my app with PayPal WebPaymentsPro and at the ExpressCheckout part.

I’ve contructed a parameter in NVP format:

$nvpstr="&ADDRESSOVERRIDE=1$shiptoAddress&".$joined_nvp."&MAXAMT=".(string)$maxamt."&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt."&CALLBACKTIMEOUT=4&".$joined_nvp_ship."&INSURANCEAMT=0.00&INSURANCEOPTIONOFFERED=false&CALLBACK=https://www.ppcallback.com/callback.pl&SHIPPINGAMT=".$CALC_SHIP."&SHIPDISCAMT=0.00&TAXAMT=0.00&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType."&PAYMENTACTION=".$paymentType;

This, as an example, echo’s:

&ADDRESSOVERRIDE=1&SHIPTONAME=Name&SHIPTOSTREET=&SHIPTOCITY=&SHIPTOSTATE=&SHIPTOCOUNTRYCODE=GB&SHIPTOZIP=&L_NAME0=ITEM!&L_NUMBER0=40&L_DESC0=S&L_QTY0=1&L_AMT0=22.50&L_NAME1=ITEM2&L_NUMBER1=186&L_DESC1=S/M&L_QTY1=1&L_AMT1=14.00&L_NAME2=ITEM3&L_NUMBER2=105&L_DESC2=8&L_QTY2=1&L_AMT2=23.00&MAXAMT=66.5&AMT=59.5&ITEMAMT=59.5&CALLBACKTIMEOUT=4&L_SHIPPINGOPTIONLABEL0=UK - Free Delivery (UK orders over £50)&L_SHIPPINGOPTIONNAME0=UK - Free Delivery (UK orders over £50)&L_SHIPPINGOPTIONAMOUNT0=0&L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONLABEL1=UK-Recorded Delivery - £3.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONNAME1=UK-Recorded Delivery - £3.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONAMOUNT1=4&L_SHIPPINGOPTIONISDEFAULT1=false&L_SHIPPINGOPTIONLABEL2=UK-Special Next Day Delivery - £6.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONNAME2=UK-Special Next Day Delivery - £6.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONAMOUNT2=7&L_SHIPPINGOPTIONISDEFAULT2=false&INSURANCEAMT=0.00&INSURANCEOPTIONOFFERED=false&CALLBACK=https://www.ppcallback.com/callback.pl&SHIPPINGAMT=0&SHIPDISCAMT=0.00&TAXAMT=0.00&ReturnUrl=http%3A%2F%2Fwww.xxxxx.co.uk%3A80%2Fshop%2Fphp_nvp_samples%2FReviewOrder.php%3FcurrencyCodeType%3DGBP%26paymentType%3DSale&CANCELURL=http%3A%2F%2Fwww.xxxxx.co.uk%3A80%2Fshop%2Fphp_nvp_samples%2FSetExpressCheckout.php%3FpaymentType%3DSale&CURRENCYCODE=GBP&PAYMENTACTION=Sale

If I attempt to pass the parameter to PayPal, I get an error stating that the Flat-rate shipping options are missing.

However, if I echo the above code into a browser, then copy and paste in place of the variable parameter (so it is simply text):

$nvpstr="&ADDRESSOVERRIDE=1&SHIPTONAME=Name&SHIPTOSTREET=&SHIPTOCITY=&SHIPTOSTATE=&SHIPTOCOUNTRYCODE=GB&SHIPTOZIP=&L_NAME0=ITEM!&L_NUMBER0=40&L_DESC0=S&L_QTY0=1&L_AMT0=22.50&L_NAME1=ITEM2&L_NUMBER1=186&L_DESC1=S/M&L_QTY1=1&L_AMT1=14.00&L_NAME2=ITEM3&L_NUMBER2=105&L_DESC2=8&L_QTY2=1&L_AMT2=23.00&MAXAMT=66.5&AMT=59.5&ITEMAMT=59.5&CALLBACKTIMEOUT=4&L_SHIPPINGOPTIONLABEL0=UK - Free Delivery (UK orders over £50)&L_SHIPPINGOPTIONNAME0=UK - Free Delivery (UK orders over £50)&L_SHIPPINGOPTIONAMOUNT0=0&L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONLABEL1=UK-Recorded Delivery - £3.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONNAME1=UK-Recorded Delivery - £3.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONAMOUNT1=4&L_SHIPPINGOPTIONISDEFAULT1=false&L_SHIPPINGOPTIONLABEL2=UK-Special Next Day Delivery - £6.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONNAME2=UK-Special Next Day Delivery - £6.00 (plus 50p charge per extra item)&L_SHIPPINGOPTIONAMOUNT2=7&L_SHIPPINGOPTIONISDEFAULT2=false&INSURANCEAMT=0.00&INSURANCEOPTIONOFFERED=false&CALLBACK=https://www.ppcallback.com/callback.pl&SHIPPINGAMT=0&SHIPDISCAMT=0.00&TAXAMT=0.00&ReturnUrl=http%3A%2F%2Fwww.xxxxx.co.uk%3A80%2Fshop%2Fphp_nvp_samples%2FReviewOrder.php%3FcurrencyCodeType%3DGBP%26paymentType%3DSale&CANCELURL=http%3A%2F%2Fwww.xxxxx.co.uk%3A80%2Fshop%2Fphp_nvp_samples%2FSetExpressCheckout.php%3FpaymentType%3DSale&CURRENCYCODE=GBP&PAYMENTACTION=Sale"

This works, which has really stumped me.

How can a parameter made up of variables fail, but the same output in it’s place does?

Is there something obvious that I am missing, because this is doing my brain in!