Skip to content

Paypall trx is refused because of double, order is processed as if it was succesfull #25222

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

Closed
richardreen opened this issue Oct 22, 2019 · 11 comments
Assignees
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@richardreen
Copy link

richardreen commented Oct 22, 2019

Preconditions (*)

Magento 2.3.3
Php 7.3

Steps to reproduce (*)

Customer wants to pay a order with Paypall. Customer sees an succesfull booking and order.
In the backend we see now two succesfull orders which are equal. Both have the status processing.
On our paypal account we see only 1 booking. Customer is also having 1 correct booking in their account
Talking to paypall about this, they have only one correct transaction, so there is something wrong in the software (=magento 2.3.3). Paypall did not have any issues today which could be a cause of this problem!

In the payment.log we see this:

'TOKEN' => 'EC-111484486J071683F',
'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
'TIMESTAMP' => '2019-10-22T09:54:28Z',
**'CORRELATIONID' => '99985f31b4cbc',**
'ACK' => 'Failure',
'VERSION' => '72.0',
'BUILD' => '53734851',
'L_ERRORCODE0' => '10415',
'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
'L_LONGMESSAGE0' => 'A successful transaction has already been completed for this token.',
'L_SEVERITYCODE0' => 'Error',

in the backend we see for this order :
Screenshot_20191022_181205

The system.log is filled with
2019-10-22 09:54:28] main.CRITICAL: PayPal NVP gateway errors: A successful transaction has already been completed for this token (#10415: Transaction refused because of an invalid argument. See additional error messages for details). Correlation ID: 99985f31b4cbc. Version: 72.0. [] []
[2019-10-22 09:54:33] main.CRITICAL: Exception message: Wij kunnen de express betaling niet initialiseren.
Trace:

#1 Magento\Paypal\Controller\Express\AbstractExpress\PlaceOrder->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#2 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->___callParent('execute', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#3 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->Magento\Framework\Interception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#4 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->___callPlugins('execute', array(), array(array('pluginAfterActio...'))) called at [generated/code/Magento/Paypal/Controller/Express/PlaceOrder/Interceptor.php:26]
#5 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
#6 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#7 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#8 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#9 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#), array(array('designLoader', 'customerNotifica...', 'catalog_app_acti...', 'tax-app-action-d...', 'weee-app-action-...', 'storeCheck', 'contextPlugin', 'customer-app-act...'))) called at [generated/code/Magento/Paypal/Controller/Express/PlaceOrder/Interceptor.php:104]
#10 Magento\Paypal\Controller\Express\PlaceOrder\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/App/FrontController.php:159]
#11 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#, &Magento\Paypal\Controller\Express\PlaceOrder\Interceptor#00000000723373630000000030180d93#) called at [vendor/magento/framework/App/FrontController.php:98]
#12 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#13 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#14 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94]
#15 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000723370830000000030180d93#, &Closure#00000000723370550000000030180d93#, &Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#16 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73]
#17 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000723370830000000030180d93#, &Closure#00000000723370550000000030180d93#, &Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#18 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/swissup/module-amp/Plugin/Framework/FrontController.php:48]
#19 Swissup\Amp\Plugin\Framework\FrontController->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000723370830000000030180d93#, &Closure#00000000723370550000000030180d93#, &Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#20 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#21 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#), NULL) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#22 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000072335a500000000030180d93#) called at [vendor/magento/framework/App/Http.php:137]
#23 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#24 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#25 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#0000000072335a210000000030180d93#) called at [index.php:39]

As this is a payment issue we can not remake this in a vanilla instance of M 2.3.3.

Expected result(*):
No second or more trx of the same to paypal
If Paypal report failure the order should fale also

Actual result(*)
A wrong approved order!!.

@m2-assistant
Copy link

m2-assistant bot commented Oct 22, 2019

Hi @richardreen. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@richardreen do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Oct 22, 2019
@engcom-Charlie engcom-Charlie self-assigned this Oct 24, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 24, 2019

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie
Copy link
Contributor

Hello @richardreen

We are not able to reproduce this issue on the latest 2.3-develop(2.3.3 code is merged) branch by following steps:

  1. Place order via PayPal
  2. Check order in backend for duplicates
  3. Check system.log

Result:
No duplicates and no errors in system.log

So i have to close this issue.
Thanks for your report!

@dan-ding
Copy link

dan-ding commented Dec 2, 2019

I don't know how to re-produce this yet - but it does happen on occasion with Paypal Express.
2.3.2-xyz
Missing "last transaction id" makes it pretty obvious.

Paypal payment events in order:
SetExpressCheckout => Authorization is successful (with what seems to be correct invnum/order number)
GetExpressCheckoutDetails => is successful
DoExpressCheckoutPayment (paymentaction - authorization) => is successful

Then for some reason many seconds (maybe a lot of many's) later:
DoExpressCheckoutPayment (paymentaction - authorization) is fired again; fails with the error "A successful transaction has already been completed for this token."

notes

  1. Order has created timestamp near(and after) second, failed, DoExpressCheckoutPayment, not the first.
  2. There is no transaction associated with the order (obviously)
  3. There are no errors recorded near or related to the above events (not including the error on the second authorization).

the admin reflects what's in (or not in the database) tables:
sales_order_payment has an incomplete entry (missing last transaction id)
sales_payment_transaction has no entries (obviously)

@aligent-lturner
Copy link
Contributor

We're also seeing this happen on 2.3.5-p1
One successful order, and then one (or more) failed payment attempts also resulting in orders in Magento, each without a transaction ID.

@netfarma
Copy link

netfarma commented Sep 9, 2020

Hi,

This happen also on 2.4.0

to reproduce issue just open on new browser tab return_url (paypal/express/onAuthorization) from Paypal with token and PayerID in it.
you can generate any number of orders paid

It happens because of muted error
vendor/magento/module-paypal/Model/Api/Nvp.php : 1294

/** * The response code 10415 'Transaction has already been completed for this token' * must not fails place order. The old Paypal interface does not lock 'Send' button * it may result to re-send data. */ if (in_array((string)ProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED, $this->_callErrors)) { return; }

and in the same file You can see that this errors is not imported to api object:
`public function callDoExpressCheckoutPayment()
{
$this->_prepareExpressCheckoutCallRequest($this->_doExpressCheckoutPaymentRequest);
$request = $this->_exportToRequest($this->_doExpressCheckoutPaymentRequest);
$this->_exportLineItems($request);

    if ($this->getAddress()) {
        $request = $this->_importAddresses($request);
        $request['ADDROVERRIDE'] = 1;
    }

    $response = $this->call(self::DO_EXPRESS_CHECKOUT_PAYMENT, $request);
    $this->_importFromResponse($this->_paymentInformationResponse, $response);
    $this->_importFromResponse($this->_doExpressCheckoutPaymentResponse, $response);
    $this->_importFromResponse($this->_createBillingAgreementResponse, $response);
}`

PayPal response below
`
...
'ACK' => 'Failure',
'VERSION' => '72.0',
'BUILD' => '54871143',
'L_ERRORCODE0' => '10415',
'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
'L_LONGMESSAGE0' => 'A successful transaction has already been completed for this token.',
'L_SEVERITYCODE0' => 'Error',

`

There should be new set of imported fields to discover errors

protected $_paymentErrorInformationResponse = [ 'ACK', 'L_ERRORCODE0', 'L_SHORTMESSAGE0', 'L_LONGMESSAGE0', 'L_SEVERITYCODE0' ];
and

$this->_importFromResponse($this->_paymentErrorInformationResponse, $response);

to get access to this informations

To resolve in right way You can add plugin on after call() method and check if response contains errors..

hope this help

@Kalashreeprem
Copy link

Hi,

This happen also on 2.4.0

to reproduce issue just open on new browser tab return_url (paypal/express/onAuthorization) from Paypal with token and PayerID in it.
you can generate any number of orders paid

It happens because of muted error
vendor/magento/module-paypal/Model/Api/Nvp.php : 1294

/** * The response code 10415 'Transaction has already been completed for this token' * must not fails place order. The old Paypal interface does not lock 'Send' button * it may result to re-send data. */ if (in_array((string)ProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED, $this->_callErrors)) { return; }

and in the same file You can see that this errors is not imported to api object:
`public function callDoExpressCheckoutPayment()
{
$this->_prepareExpressCheckoutCallRequest($this->_doExpressCheckoutPaymentRequest);
$request = $this->_exportToRequest($this->_doExpressCheckoutPaymentRequest);
$this->_exportLineItems($request);

    if ($this->getAddress()) {
        $request = $this->_importAddresses($request);
        $request['ADDROVERRIDE'] = 1;
    }

    $response = $this->call(self::DO_EXPRESS_CHECKOUT_PAYMENT, $request);
    $this->_importFromResponse($this->_paymentInformationResponse, $response);
    $this->_importFromResponse($this->_doExpressCheckoutPaymentResponse, $response);
    $this->_importFromResponse($this->_createBillingAgreementResponse, $response);
}`

PayPal response below
`
...
'ACK' => 'Failure',
'VERSION' => '72.0',
'BUILD' => '54871143',
'L_ERRORCODE0' => '10415',
'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
'L_LONGMESSAGE0' => 'A successful transaction has already been completed for this token.',
'L_SEVERITYCODE0' => 'Error',

`

There should be new set of imported fields to discover errors

protected $_paymentErrorInformationResponse = [ 'ACK', 'L_ERRORCODE0', 'L_SHORTMESSAGE0', 'L_LONGMESSAGE0', 'L_SEVERITYCODE0' ];
and

$this->_importFromResponse($this->_paymentErrorInformationResponse, $response);

to get access to this informations

To resolve in right way You can add plugin on after call() method and check if response contains errors..

hope this help

Can you able to solve this? we are also seeing this happen.

@carylewis
Copy link

Why is this issue closed? We are seeing this in Magento 2.3.5p2 EE.

@dmdre
Copy link

dmdre commented Dec 23, 2021

Same Here on Magento 2.4.0 CE

@dearste
Copy link

dearste commented Jul 26, 2023

2.4.3-p3 here, same issue..any fix?

@parthppwd
Copy link

Anyone able to fix this? Facing the same issue even with Magento 2.4.5-p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests