Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If the payers make payments using web-pages, then it is desirable to place (on the web-page where payment verified via SOFI) the call of the following JavaScript code:

Code Block
languagexmljs
<script type="text/javascript">
    window.collect_afs_data_func = function() {
        try {
           var url = "https://afs-api.paysecure.ru/antifraudapi/rest/afs_data_collector.js?outSystemId=...&outPaymentId=...";
            var method = "GET";
            var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new XDomainRequest();
            if ("withCredentials" in xhr) {
                xhr.open(method, url, true);
            } else if (typeof XDomainRequest != "undefined") {
                xhr = new XDomainRequest();
                xhr.open(method, url);
            } else {
                xhr = null;
            }
            if (xhr) {
                xhr.onreadystatechange=function() {
                    if (xhr.readyState==4 || xhr.readyState=="complete") {
                        try {
                            eval(xhr.responseText);
                        } catch (e) {alert(e);}
                    }
                };
                try {
                    xhr.withCredentials = true;
                } catch (e) {
                }
                xhr.send('');
            }
        } catch (e) {
            alert(e);
        }
    };
    if (window.addEventListener) {
        window.addEventListener('load', function(){window.collect_afs_data_func(); }, false);
    } else if (window.attachEvent) {
        window.attachEvent('onload', function(){window.collect_afs_data_func();});
    }
</script> 

...