question

ismdcf avatar image
ismdcf asked ·

Payment void done soon after a SaleRequest fails

Currently we are using the PaymentConnector on clover SDK to do the SaleRequests and VoidRequests.

To elaborate our flow, we are creating an order via the Clover REST APIs and then pass that orderId to our client application running on a Clover Mini 2 device. Then our client application handles the payment for that passed orderId with the clover SDKs. If the payment is successful we do a HTTP request to a third party (application logic) and based on the response for that request we proceed rest of the ordering flow or do a void if the response is failure. In case above failure scenario, we may attempt the void for the payment very shortly after the payment is done (2-5 seconds). And this void seems to fail all the time and we are wondering whether is it because we are attempting the void too soon?.

During the rest of the ordering flow there's an another flow where the void attempt is done sometime after (10-15 seconds) the SaleRequest and that executes without any issue.

We are aware that it may take some time for the order created from REST APIs to get synced to the device but the SaleRequests executes without any issue.

Please note that on the sandbox environment above issue is not happening at all. We are seeing this issue only on the Production environment.

PaymentsClover MiniClover Android SDKPaymentConnector
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.

1 Answer

· Write an Answer
David Marginian avatar image
David Marginian answered ·

Thank you for the description. I understand what you are trying to do more clearly and I suspect that this is why you are having the problems you outlined in your other post.

As you have found, your implementation is unreliable.

We are aware that it may take some time for the order created from REST APIs to get synced to the device but the SaleRequests executes without any issue.

The SaleRequest will execute without issue regardless of the state of the order on the device. Payment Connector doesn't try to determine that the order is "complete" it simply takes the order you passed, and applies the payment to it. YOU need to verify the order is "complete" if you want your application to be reliable.

To elaborate our flow, we are creating an order via the Clover REST APIs and then pass that orderId to our client application running on a Clover Mini 2 device.

I would recommend that when you pass the order id down to the Clover device that you also send the modified date/time (from the Clover server) down to the device as well. Then before you initiate the SaleRequest you are going to have to poll OrderConnector for that order and only initiate the SaleRequest once the modified data of the order is = or after that date.

There are many things that can happen with device sync and this approach may result in delays before the SaleRequest is made. You will need to handle those delays (inform the user you are waiting for the order to completely sync, etc.).

3 comments
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.

Thank you for the response.

Please note that the SaleRequest happens without any issue but the problem we are having is when we try a VoidRequest to an order immediately after a successful SaleRequest.

Is there any way to check whether the order is in voidable state before executing a void? Like any conditions we can check for in the order fetched from OrderConnector?

0 Likes 0 ·

Do you have more information on the void failures? I am guessing that the void is failing on the device (and not making it to the server). If you can provide me details on the error you are receiving I can look into it a bit. But, I would say if you are getting an error then you need to retry in a loop with timer until it succeeds. Or as I already suggested pass in the server modified time to your app and use that to poll the order on the device. You can try letting the sale go through if the order hasn't sync'd but you can block the void until it has.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ David Marginian ♦♦ ·

I enabled some more verbose logging for your production merchant. If you want to reproduce this I can take a look at what gets generated to see if I can find anything. Are you always executing a Sale on your end? I am asking because I just remembered an issue with voiding pre-auths - https://community.clover.com/questions/26811/voiding-preauth-request-via-sdk.html. That is the only time I have ever seen the "Void was null" message.

0 Likes 0 ·

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