You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context:
We have on the page a control that is used to add promotion code and gift cards. On the page load, we do not know the amount of the order because it can change depending on user input.
Problem
In GooglePay, we are able to create another variable for a card like this:
We are also able to bind the "token-success" to our custom function. What it does in the DOM is that it creates one iframe for each call, it is not ideal, but the browser is not complaining.
However, when we do that for ApplePay, we have an error saying that a control already exists in the DOM and cannot be added again.
The problem is due to the ApplePay SDK that uses the "customElements" to add data in it. When we create the card object, it calls the Apple SDK to add data to the customElements again and fails.
Proposed Solution
I do have a workaround that you guys can add it to the next release or not or if you find an alternative, let me know.
In short, we simply do not add the ApplePay sdk to the DOM again and call the function onApplePayLoaded directly instead.
function addApplePayCDN() {
// Edit Begin
if (customElements && customElements.get("apple-pay-merchandising-modal")) {
onApplePayLoaded();
return;
}
// Edit End
var script = document.createElement("script");
script.onload = onApplePayLoaded;
script.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
document.body.appendChild(script);
}
The text was updated successfully, but these errors were encountered:
Context:
We have on the page a control that is used to add promotion code and gift cards. On the page load, we do not know the amount of the order because it can change depending on user input.
Problem
In GooglePay, we are able to create another variable for a card like this:
We are also able to bind the "token-success" to our custom function. What it does in the DOM is that it creates one iframe for each call, it is not ideal, but the browser is not complaining.
However, when we do that for ApplePay, we have an error saying that a control already exists in the DOM and cannot be added again.
The problem is due to the ApplePay SDK that uses the "customElements" to add data in it. When we create the card object, it calls the Apple SDK to add data to the customElements again and fails.
Proposed Solution
I do have a workaround that you guys can add it to the next release or not or if you find an alternative, let me know.
In short, we simply do not add the ApplePay sdk to the DOM again and call the function
onApplePayLoaded
directly instead.The text was updated successfully, but these errors were encountered: