1. Home
  2. Docs
  3. V1
  4. Websocket Integration
  5. Messages

Messages

The WebSocket will send back messages for certain events.

IFrame Requested

Once the Iframe has been requested from the Secure Store server, this message will be sent. This is to verify that the request for the IFrame was sent successfully.

The event action in the message will be set to “IFRAME_REQUESTED”

Response Received

Once the IFrame has been submitted and received by Secure Store, this message will be sent.  You can close the IFrame at this point, and the Nonce will have been invalidated.

The event action in the message will be set to “RESPONSE_RECEIVED”

Example Integration

let ws = new WebSocket("wss://ws.paymentworkflowtech.com");    
    ws.onopen = function() {        
        var obj = {
            "action":"REGISTER",
            "nonce":nonce
        };
        ws.send(JSON.stringify(obj));        
    };
    ws.onmessage = function (evt) {
        var action = JSON.parse(evt.data).action;
        if(action == "IFRAME_REQUESTED")
        {
            // IFrame has been requested from the Secure Store server,
               so you can populate and show the iframe
        }
        if(action == "RESPONSE_RECEIVED")
        {
            // The response has been received by the Secure Store server,
               so you can close the iframe
        }
    };
    ws.onclose = function() {
        //Connection is Closed
    };
    ws.onerror = function(err) {
        //Error
    };

Was this article helpful to you? Yes No

How can we help?