Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paypal Express Checkout fails with unable to find token #3494

Closed
addersuk opened this issue Oct 26, 2015 · 9 comments
Closed

Paypal Express Checkout fails with unable to find token #3494

addersuk opened this issue Oct 26, 2015 · 9 comments
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Milestone

Comments

@addersuk
Copy link

I've recently installed Sylis Standard edition and i'm really impressed with the system. However i'm having a problem with Paypal integration. The payment method is setup in admin as Paypay Express Checkout and i've set the 4 settings in parameters.yml.

When i return from Paypal after payment, i'm shown a 404 page and the following error appears in the Symfony2 log

http://site.com/payment/capture/xxx?token=tokenid&PayerID=payerid

request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "A token with hash xxx could not be found." at sylius-standard/vendor/payum/payum/src/Payum/Core/Bridge/Symfony/Security/HttpRequestVerifier.php line 48 {"exception":"[object](Symfony\Component\HttpKernel\Exception\NotFoundHttpException%28code: 0%29: A token with hash xxx could not be found. at sylius-standard/vendor/payum/payum/src/Payum/Core/Bridge/Symfony/Security/HttpRequestVerifier.php:48)"} []

When i check the payment details in the admin panel the details appear to match, ie
R e t u r n u r l: http://site.com/payment/capture/xxx
C a n c e l u r l: http://site.com/payment/capture/xxx
P a y m e n t r e q u e s t 0 n o t i f y u r l: http://site.com/payment/notify/yyy

Plus some fields seem to indicate that payment was successful:
P a y m e n t i n f o 0 c u r r e n c y c o d e: GBP
P a y m e n t i n f o 0 p a y m e n t s t a t u s: Completed
P a y m e n t i n f o 0 p e n d i n g r e a s o n: None
P a y m e n t i n f o 0 r e a s o n c o d e: None
P a y m e n t i n f o 0 p r o t e c t i o n e l i g i b i l i t y: Eligible
P a y m e n t i n f o 0 p r o t e c t i o n e l i g i b i l i t y t y p e: ItemNotReceivedEligible,UnauthorizedPaymentEligible
P a y m e n t i n f o 0 e r r o r c o d e: 0
P a y m e n t i n f o 0 a c k: Success
T r a n s a c t i o n i d: bbb
L n a m e0: 1
P a y m e n t r e q u e s t 0 t r a n s a c t i o n i d: bbb
P a y m e n t r e q u e s t 0 s o f t d e s c r i p t o r: PAYPAL ******
L p a y m e n t r e q u e s t 0 n a m e0: 1
P a y m e n t r e q u e s t i n f o 0 t r a n s a c t i o n i d: bbb
P a y m e n t r e q u e s t 0 t r a n s a c t i o n t y p e: cart
P a y m e n t r e q u e s t 0 p a y m e n t t y p e: instant
P a y m e n t r e q u e s t 0 o r d e r t i m e: 2015-10-26T21:05:20Z
P a y m e n t r e q u e s t 0 f e e a m t: 0.??
P a y m e n t r e q u e s t 0 p a y m e n t s t a t u s: Completed
P a y m e n t r e q u e s t 0 p e n d i n g r e a s o n: None
P a y m e n t r e q u e s t 0 r e a s o n c o d e: None

However the status is still not complete. On paypal the order is complete, so am i missing something or is there a problem?

Composer package versions are:
omnipay/2checkout v2.1.1
omnipay/authorizenet v2.3.0
omnipay/buckaroo v2.0.1
omnipay/cardsave 2.1.2
omnipay/coinbase v2.0.4
omnipay/common v2.3.4
omnipay/dummy v2.1.1
omnipay/eway v2.2.0
omnipay/firstdata v2.2.0
omnipay/gocardless 2.2.0
omnipay/manual v2.1.1
omnipay/migs v2.1.1
omnipay/mollie v3.0.4
omnipay/multisafepay V2.2.0
omnipay/netaxept v2.3.0
omnipay/netbanx v2.1.1
omnipay/omnipay 2.3.2
omnipay/payfast v2.1.1
omnipay/payflow v2.1.1
omnipay/paymentexpress v2.1.2
omnipay/paypal v2.4.3
omnipay/pin v2.1.0
omnipay/sagepay v2.2.0
omnipay/securepay v2.1.0
omnipay/stripe v2.2.1
omnipay/targetpay v2.2.1
omnipay/worldpay v2.1.1
pagerfanta/pagerfanta v1.0.3
paypal/rest-api-sdk-php V0.5.0
paypal/sdk-core-php V1.2.0
payum/omnipay-bridge 0.14.2
payum/payum 0.14.7
payum/payum-bundle 0.14.4
sylius/sylius dev-master 7db8df6
symfony/symfony v2.7.5

Let me know if you need further info

@pjedrzejewski pjedrzejewski added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Oct 27, 2015
@pjedrzejewski pjedrzejewski added this to the v1.0.0-ALPHA1 milestone Oct 27, 2015
@pjedrzejewski
Copy link
Member

/cc @makasim

@makasim
Copy link
Contributor

makasim commented Oct 27, 2015

Where do you store tokens? Seems like it was not persisted correctly. Could you please post payum configuration part.

@addersuk
Copy link
Author

I am using the standard config provided by @SyliusCoreBundle/Resources/config/app/payum.yml, so using Doctrine with a postgres database. I can see a table sylius_payment_security_token being populated, but i can only see a row for code yyy and not the xxx code provided as a parameter to the page.

http://site.com/payment/capture/xxx?token=tokenid&PayerID=payerid
R e t u r n u r l: http://site.com/payment/capture/xxx
C a n c e l u r l: http://site.com/payment/capture/xxx
P a y m e n t r e q u e s t 0 n o t i f y u r l: http://site.com/payment/notify/yyy

Should both tokens be recorded, or is the return url incorrect

@makasim
Copy link
Contributor

makasim commented Oct 27, 2015

they should both recorded at prepare stage, once you are back from the paypal side the capture token is removed

@addersuk
Copy link
Author

Thanks for you help, I can see them being set as i leave the site for Paypal, I'll investigate and see if i can narrow down the problem.

@addersuk
Copy link
Author

To debug this i've added the following to Payum\Bundle\PayumBundle\Controller/CaptureController
public function doAction(Request $request)
{
$token = $this->getHttpRequestVerifier()->verify($request);
$logger = $this->get('logger');
$logger->info($token->getPaymentName());
$payment = $this->getPayum()->getPayment($token->getPaymentName());
$logger->info('Got the payment.');
$payment->execute(new Capture($token));
$logger->info('Invalidate the token.');
$this->getHttpRequestVerifier()->invalidate($token);
$logger->info($token->getAfterUrl());
return $this->redirect($token->getAfterUrl());
}

And the following is output to the logs
[2015-10-28 20:18:54] app.INFO: paypal_express_checkout [] []
[2015-10-28 20:18:54] app.INFO: Got the payment. [] []
[2015-10-28 20:18:59] app.INFO: Invalidate the token. [] []
[2015-10-28 20:18:59] app.INFO: http://shop.com/checkout/purchase/forward?payum_token=aaa [] []

Instead the following requests are made and that redirect url is never followed. Yet if i enter that link into my browser the order is then completed.
1.2.3.4 - - [28/Oct/2015:20:18:54 +0000] "GET /payment/capture/xxx?token=token&PayerID=payerid HTTP/1.1" 302 671 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
1.2.3.4 - - [28/Oct/2015:20:18:59 +0000] "GET /payment/capture/xxx?token=token&PayerID=payerid HTTP/1.1" 404 555 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"

Have you got ant ideas what could be wrong.

@michalmarcinkowski
Copy link
Contributor

It's not Sylius related issue, if it's still relevant please post this question on StackOverflow (it is also the official support channel for Sylius) maybe someone will be able to help you there!

@makasim
Copy link
Contributor

makasim commented Jan 29, 2016

There was a bug, at least I can recall one which was fixed so there should not be a problem in 1.x.x

@michalmarcinkowski
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

No branches or pull requests

4 participants