question

Sukhbir Singh avatar image
Sukhbir Singh asked Jacob Abrams edited

Urgent: Need to print discount on receipt in case of Cash payment

Hi @David Marginian, @Greg

I am integrating cash and card payment in my application. I am using payment connector to make sale request for paying by either Credit or Debit card. I am using following code for the cash payment to open cash drawer and to list the payment in clover cash log:

Bundle extras = new Bundle();

extras.putParcelable(ARG_ACCOUNT, account);

CashEvent cashEvent = new CashEvent();

cashEvent.setType(Type.TRANSACTION);

cashEvent.setAmountChange(getAmountToPay());

cashEvent.setNote(“Application note”);

extras.putParcelable(ARG_CASH_EVENT, cashEvent);

Bundle response = getContentResolver().call(CashContract.CashEvent.CONTENT_URI, METHOD_ADD_ENTRY, null, extras);

if (response != null && response.getBoolean(ARG_SUCCESS, false)) {

CashDrawer.open2(context, account);

}


But I am unable to get the transaction id for the cash payment. Please suggest.


Also please suggest a way to print the discount along with the amount of discount on the receipt in case of cash payment. Please suggest.


Thanks.

PaymentsClover Android SDKPrintPaymentConnector
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
Jacob Abrams avatar image
Jacob Abrams answered Jacob Abrams edited

The code you have posted is for non-payment related cash operations. For example opening the cash drawer and removing some cash for some reason.

If you want to accept all tender types: credit card, gift card, cash, check, etc I suggest using the following Intent to start an activity that will help you handle all those things:

public static final String ACTION_CLOVER_PAY = "com.clover.intent.action.PAY";

See full documentation here: https://github.com/clover/clover-android-sdk/blob/master/clover-android-sdk/src/main/java/com/clover/sdk/v1/Intents.java

PaymentConnector seems to offer only card present functionality and doesn't appear to support other tender types.

Regarding discounts your question is not clear, you are giving customers a discount just when taking cash payments?

You may use OrderConnector#addDiscount or OrderConnector#addDiscount2 to add a discount to an order. The discount can be a percentage of the total order.

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