Worldpay propose une intégration directe via WebSockets + protocoles STOMP. Tu peux accéder à l'API Worldpay en utilisant la bibliothèque sgcWebSockets, il te suffit d'un TsgcWebSocketClient et client de protocole STOMP pour connect à cette API
Voici un exemple de code pour se connecter à Worldpay en utilisant la bibliothèque sgcWebSockets
Delphi Exemple
// 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;
