XP 6.9.x - How to know the actual web client

Enonic version: 6.9.x
OS: Centos 6

Hi,

I’m implementing a mobile payment solution using Vipps by DNB. On the webshop, when user goes to Checkout and klikk “Pay”, it will display an awaiting spinner, and when the user has confirmed the payment with her/his mobile phone. My server will receive a callback from Vipps backend system that says the payment is succeeded. Then my server has to tell the actual web client that the payment is done and then discard the spinner and displays a message to user.

My question is:
How can my server know and send the “succeeded” message to the actual/right web client?
Is web push API the thing I can use to solve this?

Thanks.

Have you tried to use websocket?
http://xp.readthedocs.io/en/stable/developer/ssjs/websockets.html

1 Like

Hi,

I don’t know this API but I would guess the web client sends a unique token, the Vipps server stores it, sends the same token to your phone, then pushes this back as a success/failure to the web client that token originated from. Following their API docs would probably be enough. Not sure Websockets are needed, you could probably listen for the “success”-message using Ajax too. Whatever works best for you =)

Websockets should be it, but you could also use traditional “pull” approaches.