2017-09-03 6 views
0

iframeメソッドを使用して、サンドボックスでAuthorize.netのホストされた支払いページを使用しています。メッセージを受け取るためにIFrameCommunicatorメカニズムを実装しました。私のページはサイズ変更イベントを取得し、イベントをキャンセルします。私は完了トランザクションでtransactResponseイベントを取得していません。IFrameCommunicator(サンドボックス)を使用しているときにtransactResponseイベントが発生しない

transactResponseイベントがサンドボックス環境で利用可能かどうかわかりますか?

答えて

0

「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)); 
 
}

関連する問題