- Issue created by @rattusrattus
- Status changed to Fixed
7 months ago 8:49am 7 December 2023 - ๐ฎ๐ฑIsrael jsacksick
Take a look at: https://stripe.com/docs/js/including:
Include the Stripe.js script on each page of your siteโit should always be loaded directly from https://js.stripe.com, rather than included in a bundle or hosted yourself.
To best leverage Stripeโs advanced fraud functionality, include this script on every page, not just the checkout page. This allows Stripe to detect suspicious behavior that may be indicative of fraud as customers browse your website.
- ๐ฌ๐งUnited Kingdom rattusrattus
Thanks for your prompt response! Would you accept a MR to defer the include?
- last update
7 months ago 20 pass, 2 fail - Status changed to Needs review
7 months ago 10:57am 7 December 2023 - ๐บ๐ธUnited States rszrama
@rattusrattus, what are the implications of this? Is it possibly deferring will break existing code? Just curious why they have that note re: code execution order.
- ๐บ๐ธUnited States TomTech
The test failures are likely because of the deferral.
One possible middle ground would be to NOT defer/async on checkout pages to ensure current behavior, and defer/async on all other pages, since that is more of a "nice to have".
- Status changed to Needs work
4 months ago 5:34pm 4 March 2024 - ๐บ๐ธUnited States TomTech
I've run the pipeline on the proposed MR.
The PHPUnit tests are failing because of the defer.
It also introduces a phpcs test failure.
At a minimum, we should NOT defer on the checkout pages that require the stripe scripts, e.g. checkout pages with the payment_information and/or review panes.
- Status changed to Active
4 months ago 3:20pm 7 March 2024 - ๐บ๐ฆUkraine marchuk.vitaliy Rivne, UA
@TomTech @rszrama
Yes, that's why defer/async wasn't added earlier.
I think we need to update the JS to wait for the "Stripe" object to load, as done here (see waitForSdk) https://git.drupalcode.org/project/commerce_square/-/blob/8.x-1.x/js/com...