2016-03-28 8 views
0

私はWorldPayのライトボックスの統合を行うにしようとしています。このスクリプトを使用することによりWorldPayのライトボックスの統合

<script type="text/javascript"> 
    var customOptions = { 
     iframeIntegrationId: 'libraryObject', 
     iframeHelperURL: 'https://example.com/helper.html', 
     iframeBaseURL: 'https://example.com', 
     url: 'https://payments.worldpay.com/ngpp/integration/wpg/corporate?OrderKey=YOUR_ORDER_KEY&Ticket=YOUR_TICKET_ID', 
     type: 'iframe', 
     target: 'custom-html', 
     accessibility: true, 
     debug: false, 
     language: 'en', 
     country: 'gb', 
     preferredPaymentMethod: 'VISA-SSL', 
     successURL: 'https://example.com/success', 
     cancelURL: 'https://example.com/cancel', 
     failureURL: 'https://example.com/failure', 
     pendingURL: 'https://example.com/pending', 
     errorURL: 'https://example.com/error' 
    }; 
    //initialise the library and pass options 
    var libraryObject = new WPCL.Library(); 
    libraryObject.setup(customOptions); 
</script> 

explained hereとして404 error.Anyのヘルプは本当に感謝です。

+0

おそらくYOUR_ORDER_KEYを注文キーで、YOUR_TICKET_IDをチケットIDで置き換える必要があります。 – adv12

+0

ticket_idを取得する場所 – Dil85

+0

私は分かりません。おそらく、あなたはworldpayサイトのどこかに登録する必要があります。 – adv12

答えて

0

Worldpayが提供するコードと同じコードに基づいて、この問題が発生しました。この問題は、DOMがロードされる前にlibraryObjectがインスタンス化されているために発生します.Worldpay JavaScriptは存在しないターゲット 'custom-html'にiFrameを注入しようとします。準備が整った関数内でオブジェクトのインスタンス化を移動するだけで、アクセスしようとする前にDOMがロードされていることを確認するだけです。

$(document).ready(function() { 
     // initialise the library and pass options 
     var libraryObject = new WPCL.Library(); 
     libraryObject.setup(customOptions); 
    }); 

デバッグ設定をtrueに変更すると、デバッグがVisual Studioの!ではなくブラウザのコンソール出力に書き込まれます。