Payment Request Applepay в iframe
Есть страница с реализованным payment request api, в ней есть кнопка Applepay и все работает. Но как только страница встраивается в iframe, происходит ошибка SecurityError: Trying to start an Apple Pay session from a document with an different security origin than its top-level frame.
Атрибут allowpaymentrequest='true' имеется
Обе страницы https.
Код example.com:
const applePayMethod = {
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "somemerchantid",
merchantCapabilities: ["supports3DS",],
supportedNetworks: ["masterCard", "visa"],
countryCode: "US",
},
};
const paymentDetails = {
total: {
label: "My Merchant",
amount: { value: "27.50", currency: "USD" },
},
}
try {
const request = new PaymentRequest([applePayMethod], paymentDetails, {});
const response = await request.show();
const status = processResponse(response);
response.complete(status);
} catch (e) {
console.log(e)
}
** Код страницы example-with-iframe.com/ с iframe: **
<iframe allowpaymentrequest='true' src="https://example.com/" frameborder="0"></iframe>
Ответы (2 шт):
Судя по тому, что Apple Pay работает на основном домене, домен есть в списке разрешенных для оплаты в https://developer.apple.com. Возможно, домен в iframe в него не входит.