Skip to content
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

WeChat Pay Error Handling #10385

Open
mdmoore opened this issue Feb 15, 2025 · 0 comments
Open

WeChat Pay Error Handling #10385

mdmoore opened this issue Feb 15, 2025 · 0 comments

Comments

@mdmoore
Copy link
Member

mdmoore commented Feb 15, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant