Skip to content

Webhook handler does not advance order when multiple transactions exist for the same quoteId #69

@jules-paystack

Description

@jules-paystack

Description:
In Popup (Inline) mode, when a customer abandons a payment and retries on the same Magento order, the plugin correctly initialises a new Paystack transaction reference for each attempt against the same quoteId. This is expected behaviour.

However, when Paystack delivers a charge.success webhook for the successful transaction, the webhook handler in Controller/Payment/Webhook.php looks up the Magento order using the quoteId from the webhook metadata. The handler only advances the order if exactly one order is found for that quoteId:

if($items->getTotalCount() == 1)

When a customer has made more than one payment attempt on the same quote, multiple orders exist for the same quoteId. This condition evaluates to false and the handler exits silently without advancing the order, leaving it permanently in PENDING status despite a confirmed successful payment on Paystack's side.

Impact:
Any merchant using Popup mode where customers abandon and retry payment on the same order will experience this issue. The order requires manual intervention to advance to PROCESSING. This is particularly prevalent in markets with high 3DS authentication friction where customers frequently retry.

Steps to reproduce:

  1. Customer proceeds to checkout and opens the Paystack popup
  2. Customer abandons without completing payment
  3. Customer retries payment on the same order
  4. Customer successfully completes payment on the retry
  5. Paystack delivers charge.success webhook
  6. Order remains in PENDING in Magento Admin

Expected behaviour:
The webhook handler should correctly identify and advance the most recent PENDING order for the quoteId when multiple orders exist.

Affected file:
Controller/Payment/Webhook.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions