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

How to execute the DoExpressCheckoutPayment #92

Open
bvisonl opened this issue Jan 24, 2019 · 20 comments
Open

How to execute the DoExpressCheckoutPayment #92

bvisonl opened this issue Jan 24, 2019 · 20 comments

Comments

@bvisonl
Copy link

bvisonl commented Jan 24, 2019

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).

@psrpinto
Copy link
Collaborator

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.

@bvisonl
Copy link
Author

bvisonl commented Jan 25, 2019

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());
            }
```

@jeremydu
Copy link

jeremydu commented Feb 4, 2019

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

@jeremydu
Copy link

jeremydu commented Feb 4, 2019

@bvisonl
Copy link
Author

bvisonl commented Feb 4, 2019

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.

@jeremydu
Copy link

jeremydu commented Feb 4, 2019

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

@psrpinto
Copy link
Collaborator

psrpinto commented Feb 6, 2019

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?

@jeremydu
Copy link

jeremydu commented Feb 7, 2019

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

@psrpinto
Copy link
Collaborator

psrpinto commented Feb 7, 2019

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.

@jeremydu
Copy link

jeremydu commented Feb 7, 2019

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
Copy link

@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 ?

@psrpinto
Copy link
Collaborator

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

@jeremydu
Copy link

jeremydu commented Feb 15, 2019

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

Can you help me please

@jeremydu
Copy link

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
Copy link

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

@psrpinto
Copy link
Collaborator

@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.

@jeremydu
Copy link

The documentation is correct but a complete example would be perfect

@devl-hop
Copy link

devl-hop commented Mar 8, 2019

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

@devl-hop
Copy link

devl-hop commented Mar 8, 2019

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

@jeremydu
Copy link

jeremydu commented Mar 8, 2019

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 ], ];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants