-
Notifications
You must be signed in to change notification settings - Fork 0
/
satispay.min.js
1 lines (1 loc) · 1.3 KB
/
satispay.min.js
1
!function(){function t(t,e){var o;for(o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}this.Satispay=function(){this.container=document.createElement("div"),this.container.style.display="none",document.body.appendChild(this.container);var e={key:null,webhook:null,script_url:"https://online.satispay.com/checkout.min.js",sandbox:!1};arguments[0]&&"object"==typeof arguments[0]&&(this.options=t(e,arguments[0]),this.options.sandbox&&(this.options.script_url="https://staging.online.satispay.com/checkout.min.js"))},Satispay.prototype.newPayment=function(t,e,o){var n=this;n.container.innerHTML="";var s=new XMLHttpRequest;s.onreadystatechange=function(){4==s.readyState&&200==s.status&&(n.dom_script=document.createElement("script"),n.dom_script.className="satispay-button",n.dom_script.setAttribute("src",n.options.script_url),n.dom_script.setAttribute("data-key",n.options.sandbox?n.options.key_sandbox:n.options.key),n.dom_script.setAttribute("data-amount",t),n.dom_script.setAttribute("data-description",e),n.dom_script.setAttribute("data-webhook",n.options.webhook),n.dom_script.setAttribute("data-callback",o),n.container.appendChild(n.dom_script),setTimeout(function(){document.getElementById("satisbutton").click()},1e3))},s.setRequestHeader("Cache-Control","max-age=3600"),s.open("GET",n.options.script_url,!0),s.send(null)}}();