Problem/Motivation

With the latest version 8.x-1.x (hash da90c292), 2 payments are created per order due to changes related to webhook handling. This only happens when the "Queue webhook events" is disabled. So 1 payment is created in onReturn() and another is created in processWebHook().
See the attached screenshot for more information:
Order log
Webhooks

Steps to reproduce

It can be easily reproduced using Commerce Kickstart and the latest version of commerce_stripe.

Proposed resolution

When the "Queue webhook events" option is disabled, the creation of payments and placing of orders should not happen in processWebHook().

CommentFileSizeAuthor
webhooks.png88.29 KBvmarchuk
order_log.png150.35 KBvmarchuk
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vmarchuk created an issue. See original summary.

vmarchuk’s picture

Title: With the latest version 8.x-1.x, 2 payments are created per order » 2 payments are created per order with the latest version 8.x-1.x

tomtech made their first commit to this issue’s fork.

  • tomtech committed c5dc1e84 on 8.x-1.x
    Issue #3476156 by tomtech, vmarchuk: 2 payments are created per order...
tomtech’s picture

Assigned: Unassigned » tomtech
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nicolas bouteille’s picture

From what I understand, when webhooks are enabled, Commerce and thus Commerce Stripe as well, are relying on both the return page and webhooks to mark the order as "paid" and complete. Is this the reason why 2 payments were mistakenly created here?

From what I read, when relying on webhooks to finalize the order, the return page should not try to finalize it as well anymore. Do you know why the choice has been made to keep using both these mechanisms side by side? Also, can you explain how you fixed this problem? I tried to understand the code behind the merge request 131 but did not understand it. To prevent this from happening, do we need to use "automatic_async" capture_method so that the webhooks are called faster hoping they get called before the return page?

Thank you for your enlightenments