Web Component 1.1.7
Version 1.1.7 of the Straumur web component (straumur-web-component on npm) lets you pay from your own button, choose which payment methods are shown, and fixes several bugs. It is the first stable release since 1.1.3 and needs no code changes.
Pay from your own button
You can now hide the component's pay button and start a card payment from a button on your own page.
hideSubmitButtonhides the built-in pay button on the card and stored-card forms.onCardValidityChanged(isValid, isActive)is called when the selected card form becomes valid or invalid, so you know when to enable your button.isActiveisfalsewhen no card form is selected.submitCard()submits the selected card form, as if the shopper had clicked the built-in button. It returnsfalseif the component is not ready or no card form is selected.
const checkout = new StraumurCheckout({
environment: "test",
sessionId: "ftsdre3h...e5h5as2q4",
hideSubmitButton: true,
onCardValidityChanged: (isValid, isActive) => {
document.getElementById("custom-pay-button").disabled = !(isValid && isActive);
},
});
checkout.mount("#component-container");
document.getElementById("custom-pay-button").addEventListener("click", () => {
checkout.submitCard();
});
See Custom submit button.
Choose which payment methods are shown
allowedPaymentMethods limits the component to the payment methods you list: any of card, storedcard, googlepay and applepay. Without it, every payment method in the session is shown.
Bug fixes
- A payment that returns from a redirect, for example a 3-D Secure check at the shopper's bank, is now completed correctly with
submitDetails(). - Changing the language no longer leaves the previous card fields behind on the page.
- Google Pay and Apple Pay buttons now have the right width.
Security
Dependencies used to build and test the component are updated to fix known vulnerabilities. The component's runtime dependencies are unchanged.
Updating
npm install straumur-web-component@1.1.7
Existing integrations keep working as they are. The new options are all optional.