Magento Sending Blank Token in PayPal Express Checkout

ee-1.13.1.0paypal-express

Every time I try to place order using Paypal Express for first time, It is showing the error:

PayPal gateway has rejected request. Invalid token (#10410: Invalid token)

When I logged the data to see the parameter it is sending blank token and blank payerID.

    Array
    (
        [url] => https://api-3t.sandbox.paypal.com/nvp
        [DoExpressCheckoutPayment] => Array
            (
                [TOKEN] => 
                [PAYERID] => 
                [PAYMENTACTION] => Sale
                [AMT] => 11.00
                [CURRENCYCODE] => GBP
                [BUTTONSOURCE] => Varien_Cart_EC_UK
                [NOTIFYURL] => http://magento-ba.localhost/paypal/ipn/
                [RETURNFMFDETAILS] => 1
                [ITEMAMT] => 9.17
                [TAXAMT] => 1.83
                [SHIPPINGAMT] => 0.00
                [L_NUMBER0] => 100193-01BL34C
                [L_NAME0] => Chloe lace balconette bra
                [L_QTY0] => 1
                [L_AMT0] => 9.17
                [BUSINESS] => 
                [EMAIL] => amzadfof@gmail.com
                [FIRSTNAME] => amzad
                [LASTNAME] => mojumder
                [MIDDLENAME] => 
                [SALUTATION] => 
                [SUFFIX] => 
                [COUNTRYCODE] => GB
                [STATE] => -
                [CITY] => WOKING
                [STREET] => 44 Walton Court
                [ZIP] => GU21 5ED
                [PHONENUM] => 07900642141
                [SHIPTOCOUNTRYCODE] => GB
                [SHIPTOSTATE] => -
                [SHIPTOCITY] => WOKING
                [SHIPTOSTREET] => 44 Walton Court
                [SHIPTOZIP] => GU21 5ED
                [SHIPTOPHONENUM] => 07900642141
                [SHIPTOSTREET2] => 
                [STREET2] => 
                [SHIPTONAME] => amzad mojumder
                [ADDROVERRIDE] => 1
                [METHOD] => DoExpressCheckoutPayment
                [VERSION] => 72.0
                [USER] => ****
                [PWD] => ****
                [SIGNATURE] => ****
            )

        [response] => Array
            (
                [TIMESTAMP] => 2014-11-14T15:23:32Z
                [CORRELATIONID] => 9f6a2e2e72148
                [ACK] => Failure
                [VERSION] => 72.0
                [BUILD] => 13630372
                [L_ERRORCODE0] => 10410
                [L_SHORTMESSAGE0] => Invalid token
                [L_LONGMESSAGE0] => Invalid token.
                [L_SEVERITYCODE0] => Error
            )

        [__pid] => 3936
    )

Is it possible to to set token manually in the start of the express checkout? Or any solution for it? Any help will be greatly appreciated!

Best Answer

The fact the TOKEN is empty tells that SetExpressCheckout call to PayPal was not made. This call is normally triggered once the payment step of Magento checkout is saved. It returns the TOKEN which is then used for all communications with PayPal.

Most likely you are using some checkout enhancement such as "CheckItOut" or "OneStepCheckout" and they are triggering checkout/onepage/savePayment manually. Normally they do it once the payment method is changed but if you have PayPal Express pre-selected this will not happen.

The easiest way to check it is to switch to some other payment method and then back to PayPal Express. After this if you click "Place Order" button you should be successfully redirected to PayPal.

So how to solve the issue? Firs of all contact the extension vendor and claim your money back. Then modify the code triggering savePayment action manually upon the page load.

Related Topic