woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

Apple Pay domain verification fails due to unexpected well-known file size #122

Closed csmcneill closed 6 months ago

csmcneill commented 6 months ago

Describe the bug

When installing WooCommerce Square on a fresh site, Apple Pay domain verification will fail. When inspecting the logs, the failure is a result of the .well-known/apple-developer-merchantid-domain-association file being 24 bytes larger than expected:


2024-05-17T23:20:20+00:00 Notice Error: Unable to verify domain freely-ruling-cardinal.jurassic.ninja - response = Array
(
    [errors] => Array
        (
            [0] => Array
                (
                    [category] => INVALID_REQUEST_ERROR
                    [code] => BAD_REQUEST
                    [detail] => Invalid domain `example.com`: expected GET https://example.com/.well-known/apple-developer-merchantid-domain-association to return 9098 bytes but instead returned 9122.
                    [field] => domain_name
                )

        )

)

This same error is not present on sites that have successfully verified their domain previously, even when deleting the well-known file and regenerating it by disabling and re-enabling digital wallets.

To reproduce

  1. Spin up a fresh site.
  2. Install WooCommerce Square.
  3. Connect to a Square account.
  4. Assign the location.
  5. Enable Square as a payment method.
  6. Ensure that digital wallets are enabled.
  7. Check the notice:
Apple Pay is not available with Square - there was a problem with registering your store domain with Square/Apple Pay. View the Square logs to find out what caused the registration to fail.
  1. Review the logs.
  2. Determine that domain verification failed because the well-known file is 9122 bytes.

Expected behavior

Either:

  1. The domain verification file is reduced to the expected 9098 bytes.
  2. The domain verification process works when the file is 9122 bytes (like it did previously).

Additional details

8206303-zen 8191881-zen

Given that...

...I'd say that this is an issue with Square/Block and not Apple or our integration.

We checked with the Square team in p1715992183595699-slack-CMKCR9H1C to see if this is a configuration change they made on their end.

csmcneill commented 6 months ago

The Square/Block team send this out to developers

We are reaching out to inform you about an update impacting Apple Pay via the Web Payments SDK. This change may require you to update your integration immediately to ensure you can continue accepting Apple Pay seamlessly. Square provides Web Payments SDK developers with a domain verification file, which is used to register and verify domains to accept Apple Pay. We were informed by Apple that the contents of this domain verification file have expired, requiring us to replace it with a new file. We noticed that you register domains regularly using the Register Domain API. If you are storing copies of the outdated file, you will need to update them with the new one as soon as possible to ensure any new domains registered can be successfully approved for Apple Pay. You can download the new file here. We recommend that you do not store copies of this file for longer than 24 hours, as it can be updated again in the future. Existing domains registered with the old file are not impacted by this change.

jeffpaul commented 6 months ago

@csmcneill thanks for that update from Square, I'm bumping this to critical and will likely work to get a hotfix release out ASAP to cover this.

jeffpaul commented 6 months ago

Also noting that #113 may be related

peterwilsoncc commented 6 months ago

Also noting that #113 may be related

I downloaded the verification file from the square dashboard while testing the other issue so it appears this isn't related.

nawaz0705 commented 6 months ago

8228454-zen