我正在尝试将Worldpay lightbox集成为explained here
<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> 通过使用此脚本,url显示404 error.Any帮助将非常感谢。
发布于 2016-10-21 22:31:05
基于Worldpay提供的相同代码,我刚刚解决了这个问题。导致该问题的原因很简单,因为在加载DOM之前libraryObject正在被实例化- Worldpay JavaScript试图将其iFrame注入到不存在的目标'custom-html‘中。您需要做的就是在就绪函数中移动对象实例化,以确保DOM在您尝试访问它之前已经加载,例如
$(document).ready(function () {
// initialise the library and pass options
var libraryObject = new WPCL.Library();
libraryObject.setup(customOptions);
});如果您将调试设置更改为true,可能会有所帮助-请注意,调试将写入浏览器控制台输出,而不是Visual Studio的输出!
https://stackoverflow.com/questions/36265264
复制相似问题