Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 苹果支付支付请求API iframe_Javascript_Html_Iframe_Applepay_Payment Request Api - Fatal编程技术网

Javascript 苹果支付支付请求API iframe

Javascript 苹果支付支付请求API iframe,javascript,html,iframe,applepay,payment-request-api,Javascript,Html,Iframe,Applepay,Payment Request Api,有一个页面实现了付款请求api,它有一个Applepay按钮,一切正常。但一旦页面嵌入iframe,就会出现安全错误:试图从一个安全源与顶层框架不同的文档启动Apple Pay会话。 属性allowpaymentrequest='true' HtmlFrameElement接口的allowPaymentRequest属性返回一个布尔值,指示是否可以在跨源iframe上调用付款请求API 两个页面都是https example.com: const applePayMeth

有一个页面实现了付款请求api,它有一个Applepay按钮,一切正常。但一旦页面嵌入iframe,就会出现安全错误:试图从一个安全源与顶层框架不同的文档启动Apple Pay会话。

属性allowpaymentrequest='true'

HtmlFrameElement接口的allowPaymentRequest属性返回一个布尔值,指示是否可以在跨源iframe上调用付款请求API

两个页面都是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)
            }  
使用iframe.com编码


Allowpaymentrequest属性已被弃用,浏览器不再支持该属性