Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 210 forks source link

First notification is unsuccessful but a second notification 2 minutes later send a success response => order canceled but payment is in success #607

Closed Caudalie closed 2 years ago

Caudalie commented 4 years ago

Magento version: 2.3.2 Plugin version: 5.1.0 Description

Sometimes, a first notification about an authorization or 3D-secure validation is unsuccessful. But 2 minutes later, Magento received a second notification with a success. With the first notification, Magento has yet canceled the order. And it cannot re-open this one after the second notification. So, the customer has payed but the order is not in processing. See below an example with comments from an order.

`

`

cyattilakiss commented 4 years ago

Hi @Caudalie ,

Thank you for raising this issue. Can you maybe provide us steps to reproduce the issue? Do you see any pattern when this issue happens? Thank you for your further help.

Best, Attila Adyen

yanielliot commented 4 years ago

We encounter this issue on a fairly regular basis, example:

Jan 8, 2020 11:36:22 AM - 3D-secure validation was unsuccessful. Jan 8, 2020 11:36:23 AM - 3D-secure validation was successful

Adyen then continues to update the order/process notifications as normal as never checks if order is cancelled.

Have not been able to identify a pattern as yet

brockies commented 4 years ago

Magento version: 2.3.2 Plugin version: 5.1.0 adyen/php-api-library: 4.2.0

We are also seeing the same issue. Ultimately we are seeing the payment being taken, but the order then being cancelled.

bsdnomad commented 4 years ago

Same here:

Magento OS: 2.3.2-p2
adyen/php-api-library: 4.2.0
adyen/module-payment: 5.1.0

Test gateway is processing the same amount / payment method / card type successfully.

Caudalie commented 4 years ago

Hi @cyattilakiss

There are no specific pattern or steps. This issue is difficult to reproduce because the problem is on your side when you send 2 differents notifications. I already created a ticket to your support (#1118935) in december about the same problem but with Paypal. The answer was : it's a Paypal error and you colleague recommended me to listen to the latest status update. I think you can check your logs and verify if you send several differents notifications sometimes.

stefandoorn commented 4 years ago

I'm experiencing the same issue sometimes with plugin version 5.1. Example of one we had this weekend, whereby the order gets on 'Pending' and doesn't get processed. The only way to find out is to check the revenue per day in Adyen compared to M2, and then search for such orders.

Jan 25, 2020 8:39:08 PM Pending Customer Not Notified
Payment is authorised waiting for capture
Jan 25, 2020 8:39:08 PM Canceled Customer Not Notified
Adyen HTTP Notification(s):
eventCode: AUTHORISATION
pspReference: xxx
paymentMethod: bcmc_mobile
success: true
reason:bcmc_mobile
Jan 25, 2020 8:38:07 PM Customer Not Notified
Adyen Result URL response:
authResult: Authorised
pspReference: xxx
paymentMethod: bcmc_mobile
Jan 25, 2020 8:38:00 PM Customer Not Notified
Adyen Result URL response:
authResult: cancelled
pspReference:
paymentMethod:
Jan 25, 2020 8:37:58 PM Customer Not Notified
Adyen Result URL response:
authResult: Authorised
pspReference: xxx
paymentMethod: bcmc_mobile
Jan 25, 2020 8:37:34 PM Pending Customer Notified
Jan 25, 2020 8:37:34 PM Customer Not Notified
Adyen Result response:
authResult: RedirectShopper

On request I can provide the pspReference via a Support Ticket.

bsdnomad commented 4 years ago

@cyattilakiss Unfortunately there is no strong and reproducible pattern to follow. One thing for sure - issue does not appear with test gateway. Also, we got an order cancelled due to the multiple processing requests as reported , then the same customer created another one which was successfully processed and handled.

Based on our experience I can say it happens mostly (but only accidentally) when:

Could it be caused by a service notification misconfiguration somehow, what is your opinion? The strange is we have not touched anything in production settings since at least three months.

Best, K.

cyattilakiss commented 4 years ago

Hi @bsdnomad ,

Did you also experience the issue only after updating to v5.1.0 ? This is a really valuable feedback: "issue does not appear with test gateway" We are going to investigate the issue in a live environment maybe we can find the root of the issue there and spot the difference between test and live behaviour.

Best, Attila Adyen

yanielliot commented 4 years ago

@cyattilakiss we have occurrences of this issue since at least v4.4.0 and for us VI vs MC is pretty even split. Have also never seen the issue using test cards

bsdnomad commented 4 years ago

Hi @cyattilakiss ,

Did you also experience the issue only after updating to v5.1.0 ?

No, as far as I remember issue popped up for the first time when our client was still using 4.3.x (not sure about the exact build number, perhaps 0) Since then most of the orders go through successfully but those with high amounts sometimes get cancelled.

This is a really valuable feedback: "issue does not appear with test gateway" We are going to investigate the issue in a live environment maybe we can find the root of the issue there and spot the difference between test and live behaviour.

Best, K.

stefandoorn commented 4 years ago

I just had an example with Bancontact, first refused and then paid.

galdiuz commented 4 years ago

We have also encountered the same problem, using v5.0.2 of the module. In our cases we can see that we get two almost simultaneous (within 1 second) POST requests to /adyen/process/redirect/ from the 3D secure service, where the first one authorizes the payment as expected and the second one cancels the order, presumably because it's not possible to authorize an already authorized order. I have no idea why this happens, but the problem appears to be with the 3D secure service. I'm going to look if I can implement a workaround against this locally until you have a proper patch ready.

joeriLock93 commented 4 years ago

Any solutions found for the problem? I get the same problems with the following setup adyen/module-payment: 4.5.4, Magento: 2.2.8

Feb 25, 2020 3:41:11 PM Pending Customer Not Notified Payment is authorised waiting for capture Feb 25, 2020 3:41:11 PM Canceled Customer Not Notified Adyen HTTP Notification(s): eventCode: AUTHORISATION pspReference: 1234 paymentMethod: ideal success: true reason:ideal Feb 25, 2020 3:40:40 PM Customer Not Notified Adyen Result URL response: authResult: Cancelled pspReference: 1234 paymentMethod: ideal Feb 25, 2020 3:39:18 PM Pending Customer Notified Feb 25, 2020 3:39:18 PM Customer Not Notified Adyen Result response: authResult: RedirectShopper

wowdeployer commented 4 years ago

For the record we are facing a very similar issue but we aren't using 3D-secure.

-> Place an order with an invalid credit card, fails (as expected) -> Place an order with a valid credit card within 2 minutes. Customer is notified that the order went through successfully and the confirmation email is sent. In Magento the status of the order is pending but a few minutes later Adyen's cron triggers a cancelation. In Magento the order remains "pending" but in Adyen's admin account panel it shows as "canceled".

PS. we are using the test gateway.

stefandoorn commented 4 years ago

We currently have this issue about once a week, resulting in a 'missed' order (long processing, unhappy customer) + reporting is incomplete. The only way to spot it properly is by comparing Adyen dashboard with our own at a daily level, and then start digging in the orders to see which one might have been actually paid.

acampos1916 commented 4 years ago

Hello all,

We merged #679 to address this issue. After investigating we found that redirect payment methods can redirect the shopper back to the store with cancelled status even though the payment was authorised or was still pending. In the plugin we were cancelling the order to make the reserved item available again in the stock as fast as possible. Because of the redirect resultCode inconsistency now we rely on the notifications to cancel (or authorise) the order.

This patch will be released in 6.x.x but since the code change is compact enough you can patch your current version yourself just to validate and proceed faster.

@wowdeployer it looks like your issue might be different as this has been only observed on 3DS payments. It seems like the notification responsible for the cancellation bears the failed order reference which is expected, but this number should be different from the reference of the successful order. We've seen this on setups where the order placement has been customized.

Ángel Campos Adyen

chefbuitenhuis commented 4 years ago

I can reproduce this with iDeal in Magento 2.3.4 using plugin version 5.4.0.

Steps to reproduce

  1. Make sure iDeal links aren't automatically opened in your bank app
  2. Create an order using iDeal
  3. Once on bank page open the transaction in your app if prompted
  4. Cancel the browser payment
  5. Pay the bank app payment

This results in a canceled/closed order. I expect Adyen to reopen the order when a payment is made, even after the original one was canceled.

Any idea on how to solve this?

fahu commented 2 years ago

Hello @acampos1916, can we reopen this case? Same as @chefbuitenhuis we also experience still issues with this on version 6.6.8.

Here you can find a order history: image

gene-roussetos commented 2 years ago

@acampos1916 We have the same issue with @fahu and other users with payments from Klarna where initial Authorisation is refused payment, which then changed the order state to cancelled. A follow up successful authorisation (probably customer used a different card on klarna or something), sent a successful authorisation.

The order was moved to Processing (not saved in the db yet), generating an invoice fails (as order for magento is still cancelled), and then order Saved. stuck in processing without an invoice

Module version 7.3.5

Morerice commented 2 years ago

Hi @gene-roussetos

Are your steps to reproduce identical to the ones mentioned in a previous comment?

Thanks, Jean Adyen

gene-roussetos commented 2 years ago

@Morerice I can provide the history notifications if that's necessary, but the general idea is the same for alternative payment methods (in our case was Klarna).

While we understand that some alternative payment methods allow users to re-attempt a payment, this, IMHO, should either be blocked by Adyen gateway (but that's not somethin anyone wants to do, it's a success payment and order) or handle the follow up successful notification correctly and reopen the order & save invoices etc.

I'm not sure if we can manually reproduce this on a testing environment but it's defo a behaviour we've seen with the live account

fahu commented 2 years ago

@Morerice I can provide the history notifications if that's necessary, but the general idea is the same for alternative payment methods (in our case was Klarna).

  • Initial notification is for failed authorisation changes order status to cancelled.

  • Follow up notification is successfull

  • Adyen Module code attempts to move the order status to processing (but not saving yet)

  • Adyen Module attempts to create an invoice, this fails because Order status is still cancelled (as not saved from previous step)

  • Adyen module saves order with new status processing.

  • Result Order stuck in processing without invoice.

While we understand that some alternative payment methods allow users to re-attempt a payment, this, IMHO, should either be blocked by Adyen gateway (but that's not somethin anyone wants to do, it's a success payment and order) or handle the follow up successful notification correctly and reopen the order & save invoices etc.

I'm not sure if we can manually reproduce this on a testing environment but it's defo a behaviour we've seen with the live account

We are facing the exact same issue with 3 - 5 orders on production per month.

It's actually not only related to Klarna but also e.g. PayPal.

I understand that we might not want to re-open the order (as this might mess up custom Interceptors/Plugins that trigger on cancelled orders), but created a new order with the same data sounds like a solid solution to me.

Morerice commented 2 years ago

@Morerice I can provide the history notifications if that's necessary, but the general idea is the same for alternative payment methods (in our case was Klarna).

* Initial notification is for failed authorisation changes order status to cancelled.

* Follow up notification is successfull

* Adyen Module code attempts to move the order status to processing (but not saving yet)

* Adyen Module attempts to create an invoice, this fails because Order status is still cancelled (as not saved from previous step)

* Adyen module saves order with new status processing.

* Result Order stuck in processing without invoice.

While we understand that some alternative payment methods allow users to re-attempt a payment, this, IMHO, should either be blocked by Adyen gateway (but that's not somethin anyone wants to do, it's a success payment and order) or handle the follow up successful notification correctly and reopen the order & save invoices etc.

I'm not sure if we can manually reproduce this on a testing environment but it's defo a behaviour we've seen with the live account

Can you also provide the steps that were done during the checkout process? This may give us further information about why you are receiving multiple contradictory notification for the same payment.

Thanks, Jean Adyen

RokPopov commented 2 years ago

Hi @fahu ,

A kind reminder - could you please provide us with the steps done in the checkout process?

Thank you in advance.

Kind regards, Rok, Adyen

fahu commented 2 years ago

@RokPopov I'm afraid that I'm not able to provide the exact checkout steps as it's not reproducible on our side. However I would assume that the provided notification history should be enough so that you can reproduce it on your side?

RokPopov commented 2 years ago

Hey @fahu

Thank you for your reply. As the plugin does not generate the notifications but rather receives them from the Adyen platform, solely the notification history shared is not enough for us to be able to replicate this. As the notification flow mentioned should not really be happening, we would kindly require the details of the checkout flow steps that caused it.

Thank you in advance.

Kind regards, Rok, Adyen

fahu commented 2 years ago

Can you help me understand how I can provide the checkout steps if this is happening only 3-5 times a month to our customers and we can't reproduce it internally?

fahu commented 2 years ago

This also happens with Adyen v8.2.5 :(

Morerice commented 2 years ago

Hi,

We have investigated this issue internally with @fahu. Our hypothesis is that a custom express checkout option for paypal (not offered by this module) was implemented and used. All payments which had this double notification issue were a result of this custom payment method.

As a suggestion in these cases, an idempotency key should be used.

Feel free to re-open this issue if this problem occurs with any other payment method types that are offered by the module.

Thanks, Jean Adyen