开发者

Paypal Checkout Express empty cart problem

开发者 https://www.devze.com 2023-03-13 17:32 出处:网络
I\'m working on Paypal integration in my website, following Paypal\'s API specifications. I\'m testing it in a sandbox, and after sending a SetExpressCheckout request like this:

I'm working on Paypal integration in my website, following Paypal's API specifications. I'm testing it in a sandbox, and after sending a SetExpressCheckout request like this:

CURRENCYCODE=EUR
&RETURNURL=http%3A%2F%2Fwww.xxxxxxxx
&CANCELURL=http%3A%2F%2Fwww.xxxxxxxx
&PAYMENTACTION=Sale
&L_PAYMENTREQUEST_0_NAME0=T-shirt+ring-spun+attillata%3B+taglia+L%3B+colore+Navy
&L_PAYMENTREQUEST_0_NUMBER0=0LLR7IQ-B0SIE+%28Product+%230LLR7IQ-B0SIE%29
&L_PAYMENTREQUEST_0_DESC0=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&开发者_Go百科amp;L_PAYMENTREQUEST_0_AMT0=1.90
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME1=T-shirt+ring-spun+attillata%3B+taglia+M%3B+colore+Dark+Heather
&L_PAYMENTREQUEST_0_NUMBER1=0LLR7IQ-2KEI1+%28Product+%230LLR7IQ-2KEI1%29
&L_PAYMENTREQUEST_0_DESC1=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT1=1.90
&L_PAYMENTREQUEST_0_QTY1=1
&L_PAYMENTREQUEST_0_NAME2=T-shirt+ring-spun+attillata%3B+taglia+S%3B+colore+White
&L_PAYMENTREQUEST_0_NUMBER2=0LLR7IQ-TFOHI+%28Product+%230LLR7IQ-TFOHI%29
&L_PAYMENTREQUEST_0_DESC2=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT2=1.59
&L_PAYMENTREQUEST_0_QTY2=1
&ITEMAMT=5.39
&TAXAMT=1.08
&SHIPPINGAMT=0.00
&AMT=6.47
&ALLOWNOTE=1
&USER=XXXXXXXX
&PWD=XXXXXXXX
&SIGNATURE=XXXXXXXX
&METHOD=SetExpressCheckout
&VERSION=53.0

I forward the user to here, which is the token Paypal gives me back in response to my first request.

The problem is that, despite the successful request with all prices set in, I have an empty Paypal review page, with absolutely no prices into.

What am I missing?


Attack of the poor API docs! Paypal sure tried hard, but they fall short. I've fought this API and won! :)

Change these values in what you already have... let me know if it takes care of the problem

&PAYMENTREQUEST_0_PAYMENTACTION=Sale [[ <--- payment action ]]
&PAYMENTREQUEST_0_CURRENCYCODE=EUR [[<-- currency code]]
&PAYMENTREQUEST_0_ITEMAMT=5.39  [[<---- subtotal here]]
&PAYMENTREQUEST_0_TAXAMT=1.08 [[<---- tax here]]
&PAYMENTREQUEST_0_SHIPPINGAMT=0.00 [[<---- shipping here]]
&PAYMENTREQUEST_0_AMT=6.47 [[<---- grand total here]]
&PAYMENTREQUEST_0_ALLOWNOTE=1


This one bugged me as well for a couple of days.

Using the Java SDK from developer.paypal.com (as of 2008), I finally came across a new version of the SDK (Nov 2011) at https://www.x.com/developers/paypal/documentation-tools/sdk#3

Using the new SDK (in particular, the updated paypal_base.jar) however did NOT yet solve my issue.

You have to figure out the correct API Version String to make it run. With version "51.0" (as in some of my example code), the call failed. As with version "78.0", the new SDK did the job.

Cheerio....


In addition to the other comments here, be sure to use the undocumented "useraction" option when you redirect to PayPal after getting the response from SetExpressCheckout:

?cmd=_express-checkout&useraction=commit&token=the-returned-token

(the link below no longer works)

Here's the PayPal forum reference to this parameter

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号