-
Notifications
You must be signed in to change notification settings - Fork 20
Upgrading to Remote Pay Cloud v3
Version 3.0 of the Remote Pay Cloud SDK adds support for new markets and Clover’s Loyalty API. As a major version, there are also differences that may require developers to make code changes when upgrading their applications. The needed changes depend on the protocol app used by the integration (Secure Network Pay Display or Cloud Pay Display).
Remote Pay integrators using SNPD must change their application’s connecting code for version 3.0.
Using SDK version 1.4, connections to a Clover device with SNPD are configured by constructing a WebSocketPairedCloverDeviceConfiguration
.
var connectorConfiguration = new clover.WebSocketPairedCloverDeviceConfiguration(
"wss://192.168.0.14:12345/remote_pay", // endpoint
"SWDEFOTWBD7XT.9MGLGMDLSYWTV", // applicationId
"Javascript Simple Sample", // posName
"Register_14", // serialNumber
null, // authToken
clover.BrowserWebSocketImpl.createInstance, // webSocketFactory
new clover.ImageUtil(), // imageUtil
1000, // heartbeatInterval
3000 // reconnectDelay
);
Version 3.0 introduces the WebSocketPairedCloverDeviceConfigurationBuilder
that allows for a simpler connection configuration without unnecessary parameters. It is recommended that integrators update their code to use the builder.
const networkConfigurationBuilder = new clover.WebSocketPairedCloverDeviceConfigurationBuilder(
"SWDEFOTWBD7XT.9MGLGMDLSYWTV", // applicationId
"wss://192.168.0.30:12345/remote_pay", // uri
“myPOS”, //posName
"Register_30", //serialNumber
null, //authToken
onPairingCode, //onPairingCode
onPairingSuccess //onPairingSuccess
);
The following parameter changes are required to migrate from the constructor to the builder:
- Move the
endpoint
parameter from the first position to the second position. - Remove the following parameters:
webSocketFactory
imageUtil
heartbeatInterval
reconnectDelay
- Add
onPairingCode
as the sixth parameter andonPairingSuccess
as the seventh parameter. These are functions that the device will call when pairing has been requested and when the pairing has been successfully completed.
- var connectorConfiguration = new clover.WebSocketPairedCloverDeviceConfiguration(
+ const networkConfigurationBuilder = new clover.WebSocketPairedCloverDeviceConfigurationBuilder(
- "wss://192.168.0.14:12345/remote_pay", // endpoint
"SWDEFOTWBD7XT.9MGLGMDLSYWTV", // applicationId
+ "wss://192.168.0.30:12345/remote_pay", // uri
"myPOS", // posName
"Register_30", // serialNumber
null, // authToken
- clover.BrowserWebSocketImpl.createInstance, // webSocketFactory
- new clover.ImageUtil(), // imageUtil
- 1000, // heartbeatInterval
- 3000 // reconnectDelay
+ onPairingCode, //onPairingCode
+ onPairingSuccess //onPairingSuccess
);
Remote Pay integrators using CPD are not required to change their application’s connecting code for version 3.0. Existing usages of the WebSocketCloudCloverDeviceConfiguration will continue to work without modification. However, Clover recommends changing the application to use the the builder when upgrading to SDK version 3.0.
Using SDK version 1.4, connections to a Clover device with SNPD are configured by constructing a WebSocketCloudCloverDeviceConfiguration
.
var connectorConfiguration = new clover.WebSocketCloudCloverDeviceConfiguration(
"SWDEFOTWBD7XT.9MGLGMDLSYWTV", // applicationId
clover.BrowserWebSocketImpl.createInstance, // webSocketFactory
new clover.ImageUtil(), // imageUtil
"https://sandboxdev.dev.clover.com/", // cloverServer
"7aacbd26-d900-8e6a-80f0-ae55f5d1cae2", // accessToken
new clover.HttpSupport(XMLHttpRequest), // httpSupport
"VKYQ0RVGMYHRR", // merchantId
"f0f00afd4bc9c55ef0733e7cb8c3da97", // deviceId
"testTerminal1_connection1", // friendlyId
true, // forceConnect
1000, // heartbeatInterval
3000 // reconnectDelay
);
Version 3.0 introduces the WebSocketCloudCloverDeviceConfigurationBuilder
that allows for a simpler connection configuration without unnecessary parameters.
const networkConfigurationBuilder = new clover.WebSocketCloudCloverDeviceConfigurationBuilder(
"com.mycompany.app.remoteApplicationId:0.0.1", // applicationId
"f0f00afd4bc9c55ef0733e7cb8c3da97", // deviceId
"VKYQ0RVGMYHRR", // merchantId
"7aacbd26-d900-8e6a-80f0-ae55f5d1cae2", // accessToken
);
The following parameter changes are required to migrate from the constructor to the builder:
- Remove the following parameters:
webSocketFactory
imageUtil
cloverServer
httpSupport
friendlyId
forceConnect
heartbeatInterval
reconnectDelay
- Verify the required parameters are in the correct order:
a.
applicationId
b.deviceId
c.merchantId
d.accessToken
- var connectorConfiguration = new clover.WebSocketCloudCloverDeviceConfiguration(
+ const networkConfigurationBuilder = new clover.WebSocketCloudCloverDeviceConfigurationBuilder(
"SWDEFOTWBD7XT.9MGLGMDLSYWTV", // applicationId
- clover.BrowserWebSocketImpl.createInstance, // webSocketFactory
- new clover.ImageUtil(), // imageUtil
- "https://sandboxdev.dev.clover.com/", // cloverServer
- "7aacbd26-d900-8e6a-80f0-ae55f5d1cae2", // accessToken
- new clover.HttpSupport(XMLHttpRequest), // httpSupport
- "VKYQ0RVGMYHRR", // merchantId
- "f0f00afd4bc9c55ef0733e7cb8c3da97", // deviceId
+ "f0f00afd4bc9c55ef0733e7cb8c3da97", // deviceId
+ "VKYQ0RVGMYHRR", // merchantId
- "testTerminal1_connection1", // friendlyId
- true, // forceConnect
- 1000, // heartbeatInterval
- 3000 // reconnectDelay
+ "7aacbd26-d900-8e6a-80f0-ae55f5d1cae2", // accessToken
);