Skip to content

Notification successfully processed with non adyen payment method #2917

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

Open
dimitriBouteille opened this issue Mar 20, 2025 · 3 comments · May be fixed by #2924
Open

Notification successfully processed with non adyen payment method #2917

dimitriBouteille opened this issue Mar 20, 2025 · 3 comments · May be fixed by #2924
Assignees
Labels
Bug report Indicates that issue has been marked as a possible bug

Comments

@dimitriBouteille
Copy link
Contributor

Describe the bug

In some cases the Adyen webhook is executed when the payment method used for the order is not an Adyen method.

Indeed, if a customer makes a first attempt to pay with Adyen Apple Pay for example, then validate the order with another payment method (other than Adyen), the AUTHORIZATION webhook is executed and the order is put in pending status or canceled.

We have already had a few cases, especially when payment with Adyen Apple Pay fell through. Here are two examples:

Image

Image

To Reproduce

In our case, the bug has always occurred with Apple Pay, but the bug is probably present for other methods

Steps to reproduce the behavior:

  1. Go to cart
  2. Try payment with invalid Apple Pay card
  3. The payment is refused
  4. Try payment with another payment method like bank transfer
  5. Wait the webhook AUTHORIZATION is executed
  6. 💥

Expected behavior

If the order is placed with a payment method that is not Adyen, the webhook must not be executed.

Looking at the function Adyen\Payment\Helper\Webhook::processNotification() there is no verification of the payment method used for the order, it is necessary to verify the payment method before executing the notification.

Magento version

2.4.7

Plugin version

9.8.0

@dimitriBouteille dimitriBouteille added the Bug report Indicates that issue has been marked as a possible bug label Mar 20, 2025
@candemiralp
Copy link
Member

Hello @dimitriBouteille,

Thank you for reporting this case. It looks like valid issue but I have some questions before creating an internal ticket.

Ideally, we would except the previous order is discarded (and later cancelled by the webhook) and the new payment attempt would create a new order. Is that the case for you or is the logic different for non-Adyen payment method?

Best Regards,
Can

@candemiralp candemiralp self-assigned this Mar 24, 2025
@dimitriBouteille
Copy link
Contributor Author

dimitriBouteille commented Mar 27, 2025

Hi @candemiralp

For Apple Pay and probably other methods, there is no order creation when payment fails. Thus, the ID increment generated in the quote table is used to create the order when the client tests with a new method after the first attempt has failed.

I think this is what happens in Magento:

  • Create new cart
  • Reservation of an increment_id in the quote table
  • First attempt to pay with Apple Pay
  • The quote.increment_id value is used as merchantReference by Adyen
  • The payment is refused and no order is created but the increment_id is still usable
  • New payment attempt
  • Order created with quote.increment_id

This is the code that allows you to reserve an increment_id in \Magento\Quote\Model\Quote::reserveOrderId()

Image

And here is the code that makes the placeOrder, if the place does not work the order is not created : \Magento\Sales\Model\Service\OrderService::place()

Image

@dimitriBouteille
Copy link
Contributor Author

Hi @candemiralp any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants