【发布时间】:2017-09-03 01:39:16
【问题描述】:
我正在使用 iframe 方法在沙盒中使用 Authorize.net 托管支付页面。我实现了 IFrameCommunicator 机制来接收消息。我的页面获得调整大小事件和取消事件。我没有收到关于已完成交易的 transactResponse 事件。
想知道transactResponse事件在沙盒环境中是否可用?
【问题讨论】:
标签: authorize.net
我正在使用 iframe 方法在沙盒中使用 Authorize.net 托管支付页面。我实现了 IFrameCommunicator 机制来接收消息。我的页面获得调整大小事件和取消事件。我没有收到关于已完成交易的 transactResponse 事件。
想知道transactResponse事件在沙盒环境中是否可用?
【问题讨论】:
标签: authorize.net
您应该设置“hostedProfileIFrameCommunicatorUrl”值。例如:
$setting = new AnetAPI\SettingType();
$setting->setSettingName("hostedProfileIFrameCommunicatorUrl");
$url = 'your url';
$setting->setSettingValue($url);
$request->addToHostedProfileSettings($setting);
$controller = new AnetController\GetHostedProfilePageController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
function callParentFunction(str) {
var referrer = document.referrer;
var s = {qstr : str , parent : referrer};
//console.log(s); str include response .
if(referrer == 'https://test.authorize.net/customer/addPayment'){
switch(str){
case 'action=successfulSave' :
//your code
break;
}
}
}
function receiveMessage(event) {
if (event && event.data) {
callParentFunction(event.data);
}
}
if (window.addEventListener) {
window.addEventListener("message", receiveMessage, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", receiveMessage);
}
if (window.location.hash && window.location.hash.length > 1) {
callParentFunction(window.location.hash.substring(1));
}
【讨论】: