question

kcinfuse avatar image
kcinfuse asked kcinfuse edited

Cancelling an order on pay screen

I'm developing an Android app that utilizes the Clover SDK.


When a user clicks a button in my app, we create a new order, and they are redirected to the Clover register with that specific order.


When they check out, I launch a custom modal on the Pay screen with an "Accept" and "Cancel" button. If the user clicks "Cancel", I would like to cancel the current order and redirect to my application for the flow to restart.


I've tried using resetDevice and OrderConnector.deleteOrder, but the former does not work in clearing out the current order from the register and the latter results in the device displaying a modal that says "The current order has been deleted". The "deleteOrder" method is promising and almost what I want, but the error modal is introducing some weird behavior. On subsequent transactions in my flow, if the user does not manually close the modal when it first appeared, it displays the error modal and the order I created in my app gets lost.


Is there a way to not display this "The current order has been deleted" error message OR a way to cancel the current order?

OrdersClover Android SDKPaymentConnector
10 |2000

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

1 Answer

·
kcinfuse avatar image
kcinfuse answered kcinfuse edited

Actually I found a hacky way to resolve this. For others that are curious:


Instead of deleting: I first create a new order, then I use the ACTION_START_REGISTER activity, setting the EXTRA_ORDER_ID to the newly created order id, then I start the intent and at the same time start an intent for my Clover app. This seems to effectively "reset" the state of the register. For future ACTION_START_REGISTER intents, we are not brought back to an old order.


It does keep the old order as OPEN though, so you may want to find a way to deal with that.


Hope this made sense...

10 |2000

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