Closed
Description
Describe the bug
On each order screen where WooPayments is the payment method, we fetch the charge to determine if the charge is disputed and render a disputed order notice.
This is contributing to excessive Invalid request error: resource_missing (charge id)
errors occurring (see logstash), due to:
- the charge ID stored as order meta may be for a live transaction, and the site is in test mode (or vice versa).
- the charge ID stored as order meta may not exist anymore (I'm unsure if this is a possibility).
To Reproduce
- Use a WooPayments account that can switch between live/test mode (e.g. onboard with real bank account details).
- Enable test mode.
- Create a disputed order in test mode using the card
4000000000000259
. - View the order. See the dispute notice introduced in 6.2.
- Switch to live mode.
- View the order. See request to
/charges
responds500
with messageError: No such charge: 'ch_abcde'; a similar object exists in test mode, but a live mode key was used to make this request.
Additional context
- Slack discussion Aug 26 2023: p1692999889340419-slack-CGGCLBN58
- Slack discussion Jul 24 2023: p1690190397004289-slack-CGGCLBN58
- The disputed order notice was introduced in WooPayments 6.2:
Epic: WCPay Disputes – Highlight active dispute in Woo order details screen #6354
Activity