question

yasu avatar image
yasu asked ·

How to void a payment

Hello,


I have been implementing a function to void a payment on a Clover semi-integrated app with Android Studio (Java), but without success so far.


I'm trying to do so with this "MakeRefundActivity": https://github.com/clover/remote-pay-android-examples/blob/master/remote-pay-android-simple-example/src/main/java/com/example/clover/remotepayandroidsimpleexample/MakeRefundActivity.java

but I'm wondering if this is outdated because I don't see a constructor which have two parameters in the class SaleRequest.

pendingSale = new SaleRequest(1000, MainActivity.getNextId());

I assume you have to fetch a payment to void in onCreate first, then in onSaleResponse you can collect paymentId and orderId to void it.

So, how am I supposed to retrieve a payment in order to void it? If there is another resource to follow, it would be appreciated.

Clover Android SDK
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 ·

Your point of sale will need to save off the payment and order ID when you get a sale response.

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

Hello David,

Thank you for your reply. I got a "success" in my log by following your advice, but now I realise the "Need a receipt?" screen does not show up after the void transaction.


My log

W/PAY-----: onVoidPaymentResponse: VoidPaymentResponse{json='{"success":true,"result":"SUCCESS","reason":null,"message":"Void was USER_CANCEL","paymentId":"8BA5XZZXQ54T6"}', bundle=null, changeLog=Bundle[{success=null, reason=null, result=null, paymentId=null, message=null}]}


VoidPaymentRequest vpr = new VoidPaymentRequest();
                   vpr.setPaymentId(aTransaction.getPaymentId());
                   vpr.setOrderId(aTransaction.getOrderId()
                   vpr.setVoidReason("USER_CANCEL");

                   vpr.setDisablePrinting(false);
                   Log.d(TAG, "VoidPaymentRequest: " + vpr.toString());
                   isCheckVoided = true;
                   paymentConnector.voidPayment(vpr);


Do you think I'm missing something to see the "Need a receipt?" screen?

0 Likes 0 ·
No, there is currently no way to print a void receipt via payment connector.
0 Likes 0 ·
yasu avatar image yasu David Marginian ♦♦ ·

Thank you for your reply. It means this (test #7) is outdated? If so, would you be able to tell another test to comply with Clover's norm?

0 Likes 0 ·
Show more comments

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