JMSPaymentPaypalBundle icon indicating copy to clipboard operation
JMSPaymentPaypalBundle copied to clipboard

How to execute the DoExpressCheckoutPayment

Open bvisonl opened this issue 6 years ago • 20 comments

I'm implementing this bundle but I cannot seem to find a way to trigger the DoExpressCheckoutPayment after the user is redirected back to my site...I also can't see this in the documentation (not even in the core bundle).

bvisonl avatar Jan 24 '19 21:01 bvisonl

The DoExpressCheckoutPayment is called by the approve() or approveAndDeposit() methods on the plugin controller. Please see the accepting payments guide for more information. The "Performing payments offsite" section is probably what you need.

psrpinto avatar Jan 25 '19 17:01 psrpinto

Then for some reason the transactions are not getting processed... I cannot see them on neither paypal's activity nor my bank account statements.. I have tried both useraction on commit and null... I confirmed that I am using the Live signature.

I contacted paypal and they told me that I needed to call the DoExpressCheckoutPayment and that that was what was missing in my process...

I am using the same code as the documentation that you sent (the sample basically..)

Of course I confirmed that the method approveAndDeposit() is getting called and the whole process flows normally ( I get redirected to PayPal, I verify that it's the live url and I log in with my personal account to pay, and then PayPal redirects me to my site)

Here's the piece that calls it:


$result = $this->ppc->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
            
            if (Result::STATUS_PENDING === $result->getStatus()) {
                $ex = $result->getPluginException();
    
                if ($ex instanceof ActionRequiredException) {
                    $action = $ex->getAction();
    
                    if ($action instanceof VisitUrl) {                        
                        return new RedirectResponse($action->getUrl());
                    }
    
                    throw $ex;
                }

                
            } else if (Result::STATUS_SUCCESS !== $result->getStatus()) {
                throw new \RuntimeException('Transaction was not successful: '.$result->getReasonCode());
            }
```

bvisonl avatar Jan 25 '19 17:01 bvisonl

I have exactly the same problem Does anyone have the solution ?

jeremydu avatar Feb 04 '19 13:02 jeremydu

The same https://github.com/schmittjoh/JMSPaymentPaypalBundle/issues/91

jeremydu avatar Feb 04 '19 13:02 jeremydu

I ended up downloading the SDK and following their samples on http://paypal.github.io/PayPal-PHP-SDK/sample/. Since I only needed PayPal and I was on a rush I figured it would be faster that way.

bvisonl avatar Feb 04 '19 13:02 bvisonl

Other people or being confronted with the problem and we can solve it. Can you help the community

jeremydu avatar Feb 04 '19 13:02 jeremydu

Thank you for reporting the issue.

@bvisonl @jeremydu To help me pinpoint the cause, could you please post the version of symfony, jms/payment-paypal-bundle and jms/payment-core-bundle that you're using?

You can find the version of installed packages with:

composer show -i

Also, is this something that started happening recently, or did you always have the issue?

psrpinto avatar Feb 06 '19 21:02 psrpinto

Hello,

Here are the lists of bundles with their versions. This is the first time I use your bundle.

jms/payment-core-bundle 1.3.0 jms/payment-paypal-bundle 1.1.2

jeremydu avatar Feb 07 '19 06:02 jeremydu

Thank you @jeremydu, I took the liberty of editing your comment to keep only the relevant packages.

Could you please upgrade both jms/payment-core-bundle and jms/payment-paypal-bundle to the latest versions and see if the problem persists? That's 1.4.0 and 1.2.0, respectively.

Thank you in advance.

psrpinto avatar Feb 07 '19 14:02 psrpinto

Thank you @regularjack

I updated jms/pay-paypal-bundle to version 1.2.0 and jms/payment-core-bundle I keep version 1.3.0. Always the same, I am redirected to paypal, I pay and then I am redirected to my site. The payment is not effective.

If I meet up to days jms / payment-core-bundle in version 1.4.0, or if I install on a new server this version. I have the following error:

PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: Class "" used for ser vice "jms\payment\corebundle\command\generatekeycommand" cannot be found. in /www/vendor/symfony/symfony/src /Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php:40

As a reminder I am in symfony 3.2.14

Thank you for your help

jeremydu avatar Feb 07 '19 16:02 jeremydu

@regularjack

As inicate above in update or in 1st installation I have the error: PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: Class "" used for service "jms\payment\corebundle\command\generatekeycommand" cannot be found. in /www/vendor/symfony/symfony/src /Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php:40

Do you have a resolution for this error ?

jeremydu avatar Feb 12 '19 18:02 jeremydu

@jeremydu Could you open another issue for this? I'd like this issue to remain about the problem with DoExpressCheckout. Thanks.

psrpinto avatar Feb 12 '19 18:02 psrpinto

@regularjack the issue is created : https://github.com/schmittjoh/JMSPaymentCoreBundle/issues/230

Can you help me please

jeremydu avatar Feb 15 '19 18:02 jeremydu

With the new version of the bundles It still does not work DoExpressCheckoutPayment not available jms/payment-core-bundle 1.4.0 A unified API for processing payments with Symfony jms/payment-paypal-bundle 1.2.0 Payment Bundle providing access to the PayPal API

Do you have an idea for it to work?

jeremydu avatar Feb 16 '19 21:02 jeremydu

My problem is solved. The return-url is false Call payment create and not payment complete

jeremydu avatar Feb 17 '19 16:02 jeremydu

@jeremydu I'm glad you could figure out the solution for your issue. Would you mind elaborating a bit more what the solution was? This seems to be a recurring issue affecting many people so maybe I need to improve the documentation, but to do that I'd like to be sure of what the issue was. Thanks in advance.

psrpinto avatar Feb 20 '19 18:02 psrpinto

The documentation is correct but a complete example would be perfect

jeremydu avatar Feb 20 '19 20:02 jeremydu

Hi, I have the same problem. @jeremydu can i have your solution, please.

devl-hop avatar Mar 08 '19 15:03 devl-hop

I don't khow how to execute DoExpressCheckoutPayment after the user is redirected back to my site

devl-hop avatar Mar 08 '19 15:03 devl-hop

My error was of return_url by id_payment_complete instead of id_payment_create

Example : $config = [ 'paypal_express_checkout' => [ 'return_url' => $this->generateUrl('id_payment_create', [ XXXXXXXXXXXX ], UrlGeneratorInterface::ABSOLUTE_URL), 'cancel_url' => $this->generateUrl('id_show', [ XXXXXXXXXXXX ], UrlGeneratorInterface::ABSOLUTE_URL), 'useraction' => 'commit', 'default_method' => 'payment_paypal', // Optional ], ];

jeremydu avatar Mar 08 '19 18:03 jeremydu