Worldpay灯箱集成 [英] Worldpay lightbox Integration

查看:131
本文介绍了Worldpay灯箱集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Worldpay灯箱集成为在此处解释

I am trying to do the Worldpay lightbox integration as 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错误.任何帮助将不胜感激.

By using this script the url shows 404 error.Any help would really appreciated.

推荐答案

基于Worldpay提供的相同代码,我刚刚遇到了这个问题.造成此问题的原因仅是因为在加载DOM之前实例化了libraryObject-Worldpay JavaScript尝试将其iFrame注入到不存在的目标"custom-html"中.您需要做的就是在ready函数中移动对象实例,以确保在尝试访问DOM之前已加载DOM,例如

I've just hit this problem, based upon the same code provided by Worldpay. The issue is caused simply because the libraryObject is being instantiated before the DOM is loaded - the Worldpay JavaScript attempts to inject its iFrame into the target 'custom-html' which doesn't exist. All you need to do is move the object instantiation within a ready function to ensure the DOM has loaded before you try to access it, e.g.

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

如果将调试设置更改为true,则可能会有所帮助-请注意,调试是写入浏览器控制台输出而不是Visual Studio的!

It might help if you change the debug setting to true - note that the debug is written to the browser console output rather than Visual Studio's!

这篇关于Worldpay灯箱集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆