1

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.
&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?

love Computer science
  • 1,824
  • 4
  • 20
  • 39
Dmitri Sologoubenko
  • 2,909
  • 1
  • 23
  • 27

3 Answers3

2

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
Chris Baker
  • 49,926
  • 12
  • 96
  • 115
  • thanks, i have found these info and changed my request accordingly, but now the problem is that paypal doesn't debit my transactions on buyer's account (and does not credit them on my seller account) in production. Despite the call to DoExpressCheckoutPayment (with the same request data as in prevoius SetExpressCheckout API call) return with Success... Is my transaction flow correct (as follows)? 1) Send POST SetExpressCheckout request (with all order data, totals etc) and parse response; 2) if response is successful, redirect user's browser to paypal's website (webscr); – Dmitri Sologoubenko Jun 17 '11 at 10:19
  • 3) when paypal redirects user to callback url I specified in setexpresscheckout, I call GetExpressCheckoutDetails and then perform a POST DoExpressCheckoutPayment request to Paypal, and if successful, say OK to the user. – Dmitri Sologoubenko Jun 17 '11 at 10:25
  • 1
    Yes, that is the correct flow. Are you getting 'Success' in the `ACK` key of the return value? If so, then everything should be good. Make sure, though, that you aren't still using your sandbox API and credentials! – Chris Baker Jun 17 '11 at 14:04
  • Thanks, I've found the problem: bad parameter in API call. THank you for your help. – Dmitri Sologoubenko Jun 18 '11 at 09:48
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....

hjh
  • 11
  • 1
0

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

TechSavvySam
  • 1,382
  • 16
  • 28