Worldpay offers direct integration using WebSockets + STOMP protocols. You can access to Worldpay API using sgcWebSockets library, just need a TsgcWebSocketClient and STOMP Protocol client in order to connect to this API
Find below a sample code to connect to Worldpay using sgcWebSockets library
// create websocket client oClient := TsgcWebSocketClient.Create(nil); oClient.URL := 'wss://localhost:8080/ipc-app/payment/PAYPOINT1'; // create stomp client and attach to websocket client oSTOMP := TsgcWSPClient_STOMP.Create(nil); oSTOMP.OnSTOMPConnected := OnSTOMPConnectedEvent; oSTOMP.Client := oClient; // add your authorization key to CONNECT header oSTOMP.ConnectHeaders.Clear; oSTOMP.ConnectHeaders.Add('x-wp-authorization:xxxxxxxxxxxxxxxxxx'); // connect to STOMP server oClient.Active := True; // after client connects successfully to server, subscribe to events procedure OnSTOMPConnectedEvent(Connection: TsgcWSConnection; Version, Server, Session, HeartBeat, RawHeaders: string); begin oSTOMP.Subscribe('sub-0', '/reply/v1/error'); oSTOMP.Subscribe('sub-1', '/reply/v1/pos/registration'); oSTOMP.Subscribe('sub-2', '/reply/v1/payment/notification'); end;
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.