【问题标题】:Not getting transactResponse event when using IFrameCommunicator (sandbox)使用 IFrameCommunicator(沙盒)时未收到 transactResponse 事件
【发布时间】:2017-09-03 01:39:16
【问题描述】:

我正在使用 iframe 方法在沙盒中使用 Authorize.net 托管支付页面。我实现了 IFrameCommunicator 机制来接收消息。我的页面获得调整大小事件和取消事件。我没有收到关于已完成交易的 transactResponse 事件。

想知道transactResponse事件在沙盒环境中是否可用?

【问题讨论】:

    标签: authorize.net


    【解决方案1】:

    您应该设置“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));
    }

    【讨论】:

      猜你喜欢
      • 2018-01-25
      • 2016-10-18
      • 2011-09-04
      • 2017-12-04
      • 2012-01-08
      • 2016-03-07
      • 2012-07-22
      • 2016-06-03
      • 2013-07-22
      相关资源
      最近更新 更多