如此处所述https://developers.payrexx.com/docs/mobile-apps-javascript
我想与我想在 webview_flutter 插件中创建的 iframe 的 javascript 事件进行交互。
以下示例代码在官方文档中给出
window.addEventListener('message', handleMessage(this), false);
和
function handleMessage(e) {
if (typeof e.data === 'string') {
try {
var data = JSON.parse(e.data);
} catch (e) {}
if (data && data.payrexx) {
jQuery.each(data.payrexx, function(name, value) {
switch (name) {
case 'transaction':
if (typeof value === 'object') {
if (value.status === 'confirmed') {
//handling success
} else {
//handling failure
}
}
break;
}
});
}
}
}
你知道这样做的方法吗?我已经实现了一个 iframe,其中有我的网关地址,但无法检查付款是否已发生。