question

ahmed2403 avatar image
ahmed2403 asked ·

Device Connection Error After Completing First Transaction

After successfully completing the first transaction via our POS to the Clover Mini device using the semi-integrated option, if we try and do any more transactions from the POS software to the Clover mini, the mini doesn't recognise the transaction.

It seems maybe the first transaction isn't 'closing off' properly? After debugging the code, on the second transaction the response result is in the OnSaleResponse is 'Error {4}' and the reason is 'Device connection Error' and the message is "In Sale : SaleRequest - The Clover device is not connected."

Each time we are processing a new transaction we intiliaze the connection first.
Clover MiniUSB Pay Display
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered ·
From a quick look at the source, it doesn't make sense why initializing the connector once would cause those properties to not be set. They should be set based on the configuration you pass to the CloverConnector's constructor.
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed2403 avatar image
ahmed2403 answered ·
clover.pngI have now set it so the clover is initialized the same time our software is initially loaded, therefore clover is only initialized once. This together with disposing the cloverConnector in the OnSaleRequest method seems to work with new transactions after the first.

Although, since initializing the connector only once, the cloverConnector does lose some attributes, but like I said the transactions still work, so not sure how important this is?

A screenshot is attached for you to see which attributes it is losing.

Thanks

clover.png (405.7 KiB)
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered ·
I strongly recommend you initialize the Clover connector once. That will maintain a connection to the device and will prevent you from having to dispose of the connector until your application is shutdown. The example code assumes this. Please call the Dispose() method on the ICloverConnector API to clean-up your Clover Connector.
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed2403 avatar image
ahmed2403 answered ·
Okay sure, so could you please advise on disposing the connection?

Even following this guide https://docs.clover.com/clover-platform/docs/windows#section--handling-the-result-of-a-sale-transaction- didn't outline disposing a connection within the example code.

Thanks
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered ·
No, it is not. If we were to automatically dispose of it each time a response was received that would be in direct contrast of our recommendation to initialize and maintain a connection to the device.
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed2403 avatar image
ahmed2403 answered ·
Yes I agree in terms of not disposing correctly. Windows SDK and .NET POS software.

When executing a transaction using SaleRequest, the OnSaleResponse method is called. The disposing isn't it automatically handled via the Clover library?

Thanks
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered ·
It is likely that you are not properly disposing of the connector before you initialize a new one. However, re-initializing a connection to the Clover device per transaction is not recommended. We recommend that you initialize and maintain a connection to the device. What SDK are you using?
Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community