Skip to content

Upgrading to Remote Pay Cloud v3

dxcook5 edited this page Apr 4, 2019 · 2 revisions

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).

Apps using Secure Network Pay Display (SNPD)

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:

  1. Move the endpoint parameter from the first position to the second position.
  2. Remove the following parameters:
  • webSocketFactory
  • imageUtil
  • heartbeatInterval
  • reconnectDelay
  1. Add onPairingCode as the sixth parameter and onPairingSuccess 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.

SNPD upgrade

- 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
);

Apps using Cloud Pay Display (CPD)

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:

  1. Remove the following parameters:
  • webSocketFactory
  • imageUtil
  • cloverServer
  • httpSupport
  • friendlyId
  • forceConnect
  • heartbeatInterval
  • reconnectDelay
  1. Verify the required parameters are in the correct order: a. applicationId b. deviceId c. merchantId d. accessToken

CPD upgrade

- 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
);