Web Component 2.0
Version 2.0.0 of the Straumur web component (straumur-web-component on npm) is released. It changes how failed payments are reported and which language codes setLanguage takes, adds Kortalán, theming and Apple Pay with your own certificate, and fixes 3-D Secure payments that return through a redirect.
Breaking changes
Two changes need action when you upgrade from 1.x. Neither changes how the component looks.
- Failed payments call
onPaymentFailed. ARefused,CancelledorErrorresult now callsonPaymentFailed({ resultCode })instead ofonPaymentCompleted. In 1.x every result, including refusals, calledonPaymentCompleted. If you checkresultCodeinsideonPaymentCompleted, move the failure branches toonPaymentFailed. setLanguagetakes"is"/"en", the same codes as thelocaleoption, instead of"is-IS"/"en-US".
New
- Kortalán. Shown when it is enabled for your store and available for the basket amount. Add
kortalantoinstantPaymentsto show it as its own Straumur Kortalán button. Kortalán redirects the shopper, so complete the payment on your return page withsubmitDetails(). - Theming. A
themeoption:"light","dark"or"system", with optional Google Pay and Apple Pay button styles. - Choosing and ordering payment methods.
allowedPaymentMethodsnow acceptskortalan,orderPaymentMethodssets the order, andopenDefaultPaymentMethodsets the method that is expanded when the component loads. - Apple Pay with your own certificate. Merchants with their own Apple Pay merchant identifier validate the Apple Pay session through the new
onApplePayValidateMerchantoption. Without it, Apple Pay works as before. - Diagnostics logging. The component sends Straumur a log of the checkout, without card or shopper details, to help investigate payment problems. Turn it off with
enableLogging: false.
Improvements
- A loader is shown from the moment the shopper pays until the 3-D Secure challenge appears, and while the result is fetched.
- A double click on Pay can no longer start a second payment.
- If a payment request gets no answer within 90 seconds, the shopper is told the payment couldn't be confirmed, instead of that it failed.
- Accessibility: error text contrast, screen-reader labels for loaders, and keyboard support for the security code hint and the co-badged card brand picker.
Fixes
- 3-D Secure payments that return through a redirect could not be completed in 1.1.3 (also fixed in 1.1.7).
submitDetails()completes them and callsonPaymentCompletedoronPaymentFailed. - A fast click on Pay right after the card details were entered could be ignored.
- The Google Pay and Apple Pay 3-D Secure challenge is shown at full height.
Installing
npm install straumur-web-component@^2.0.0
For the script tag, pin the version: https://unpkg.com/straumur-web-component@2.0.0.
See Web Integration for the full configuration and Upgrading from 1.x.