[Bug] useSelectedPaymentOptions can return undocumented `undefined`

As requested in [IMPORTANT] Stop creating issues here, use the Shopify Community forum instead · Issue #2521 · Shopify/ui-extensions · GitHub, I am re-raising this issue.

Please find below the details of useSelectedPaymentOptions can return undocumented `undefined` · Issue #2257 · Shopify/ui-extensions · GitHub

Please list the package(s) involved in the issue, and include the version you are using

checkout-ui-extensions

Describe the bug

The documentation for useSelectedPaymentOptions is defined as returning a number of values for handle here.

Those options for handle do not include undefined.

Steps to reproduce the behavior:

  1. Make a purchase using a bogus payment gateway, with a fake credit card
  2. Check the output of useSelectedPaymentOptions
  3. Confirm the handle is undefined

Worth noting, we can see it in production too - with real clients with real payment methods. We don’t have access to these transactions so we don’t know why this happens.

Expected behavior

I’d expect either:

  1. The documentation to explain the value can be undefined for some cases and to explain why.
  2. The code should be updated to never return undefined as per the current documentation.

Screenshots

An example of undefined:

Additional context

I assume this is unrelated to #2068 - but referencing it here for completeness.

1 Like