Payment agents Automation in Javascript and PHP
Am in need of a script that can initiate paymentagent_transfer on a button click in either Javascript or PHP or Both.
So far the code below is what I have, Help make it perfect.
<script type = "text/javascript"> function WebSocketTest() { if ("WebSocket" in window) { alert("WebSocket is supported by your Browser!"); // Let us open a web socket var ws = new WebSocket("wss://ws.binaryws.com/websockets/v3?app_id=----app_id-----"); ws.onopen = function() { // Web Socket is connected, send data using send() //Authorize request ws.send(JSON.stringify({ "authorize": "--Token---" })); alert("Message is sent..."); }; ws.onmessage = function (evt) { var received_msg = evt.data; var data = JSON.parse(received_msg); alert("Message is received..." + received_msg); console.log(received_msg); //Initiate payment Transfer ws.send(JSON.stringify({ "paymentagent_transfer": 1, "amount": 100, "currency": "USD", "transfer_to": "-----CRXXXXXXX----" })); alert("Message is sent..."); }; ws.onclose = function() { // websocket is closed. alert("Connection is closed..."); }; } else { // The browser doesn't support WebSocket alert("WebSocket NOT supported by your Browser!"); } } </script>
Comments
Hi @tsanguu , Is something not working, what help do you need?
Hello, were you able to work something out? I'm interested in this.