Skip to content

WeChat Pay Error Handling #10385

Closed
Closed
@mdmoore

Description

@mdmoore

Description

WeChat Pay payments are completed in another window after a user scans a QR code. We need to ensure that failures in the payment process are accounted for.

Acceptance criteria

  • The shopper is redirected to the checkout page when payment failures occur
  • Errors are displayed on checkout
  • Order status updates to failed
  • Stock is returned

Testing instructions

  1. Pay with WeChat Pay
  2. Fail the order in the test page

Dev notes

I should note that order statuses are managed well via webhooks. However, I’m pretty certain there’s a bug in the redirect payment method flow. The _payment_method_id meta is being added to the order up front then removed later when attaching intent info to the order. This prevents the failed webhook handler( maybe others? ) from completing, so failed orders remain in pending status. It appears to be some type of timing issue, which could possibly be limited to local environments. For example, when debugging via Xdebug (slowing things down), the _payment_method_id remains set. In normal flows it does not. There are 2 calls to set this meta. First, here when payment processing begins. Then, later with attach_intent_info_to_order() which actually occurs via attach_intent_info_to_order__legacy() with it's own call to set the payment method id meta here. Removing that last attempt to set the meta keeps the original meta from being removed. It's important here because process_webook_payment_intent_failed bails if that meta isn't present.

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions