question

litpro avatar image
litpro asked litpro commented

What's the right way to insert an activity or view into the register payment flow?

My app is mostly a fairly straightforward gift card custom tender. To activate and load a card, I'm creating a variable-price inventory item that the customer pays for, and when payment is complete I need to pass control to an activity to allow the employee to enter card data and load the card.

Right now I'm listening for ACTION_PAYMENT_PROCESSED, but once I instantiate my own activity I'm not sure how to get back to the right place in the register app. If I use ACTION_START_REGISTER with an orderId it seems to take me to the front page of the register ... if I use ACTION_START_PRINT_RECEIPTS it's not bad, but when I return to the register app the order is in the same "not done" state, waiting to print receipts.

There's also some indication that ACTION_PAYMENT_PROCESSED is the wrong thing to do, because it hijacks the register flow.

Anybody know the right thing to do here?
REST APIPaymentsBroadcasts
1 comment
10 |2000

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

litpro avatar image litpro commented ·

Regarding returning to the register: I've discovered that my intervening activity was implicitly activating my main activity when it finished. Now in the manifest I set the intervening activity's taskAffinity to "", so android doesn't activate that main activity and control returns to Register as it should. Like this:

android:taskAffinity=""

Now I just need to know whether it's kosher for me to handle ACTION_PAYMENT_PROCESSED in this way, or whether there's a better option.

I've tried responding to ACTION_REQUEST_PAYMENT_REMOTE_VIEWS with ACTION_UPDATE_PAYMENT_REMOTE_VIEWS, but I don't ever see my view and those intents are essentially undocumented in the Clover api and unmentioned in these forums. I assume they're there for some Big Vendor that Clover is catering to.

0 Likes 0 ·

1 Answer

c716524 avatar image
c716524 answered litpro commented
I think what you need is a custom tender. The merchant presses a button in between the payment process for entering your information and then continues with the payment.
https://docs.clover.com/build/custom-tenders/
However, I am currently also doing research on how to implement this using the examples provided.
1 comment
10 |2000

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

litpro avatar image litpro commented ·

Actually, my custom tender works fine. My difficulty is in adding a view in the register flow. It appears that ACTION_PAYMENT_PROCESSED occurs after payment, but before receipt printing, which is making for a very awkward UX.

1 Like 1 ·

Welcome to the
Clover Developer Community