question

mseth avatar image
mseth asked mseth answered

Adding additonal details to the payment receipt

We have a payment solution for the restaurants. The app needs to print additional details like table number, check number etc. on the payment receipt. The Clover order number is not relevant to us.

We are using the following to process payments:
Intents.ACTION_SECURE_PAY

And then we tried adding an order note to print additional details on the receipt. The receipts are printed through:
Intents.ACTION_START_PRINT_RECEIPTS

We have made sure from the settings on our device that order notes would be printed on the receipt, but we still don't see them. They are there on the payment object after I add them, but not being printed.

Any other way to get the details on the receipt?
OrdersPaymentsSandboxClover Flex
10 |2000

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

Raymond Lee avatar image
Raymond Lee Deactivated answered
Hi @mseth,

From your description, it sounds like you are setting the "note" field of the Payment object. This Payment note is not printed on receipts. It shows up when you click into the Payment from the Transactions app.

If you want to set the order note, you can set it on the Order object, which you can retrieve from the OrderConnector using the same order ID you passed to the Secure Pay app. Then you can update the order through OrderConnector.

Here is some sample code:
OrderConnector mOrderConnector = new OrderConnector(getApplicationContext(), mAccount, null);

Order order = mOrderConnector.getOrder(orderId);
order.setNote("YOUR NOTE HERE");
mOrderConnector.updateOrder(order);

As a side note, if you want to print the payment receipt directly instead of having the user needing to press the payment receipt button, you can fire a Payment PrintJob directly using either the Payment object, or the Order object and the paymentID.

Here is sample code for both cases:

For Payment object (using the first payment on an order):
OrderConnector mOrderConnector = new OrderConnector(getApplicationContext(), mAccount, null);

Order order = mOrderConnector.getOrder(orderId);
Payment payment = order.getPayments().get(0);

new StaticPaymentPrintJob.Builder().payment(payment).build().print(getApplicationContext(), mAccount);

For Order object AND payment ID (using first payment on an order):
OrderConnector mOrderConnector = new OrderConnector(getApplicationContext(), mAccount, null);

Order order = mOrderConnector.getOrder(orderId);
Payment payment = order.getPayments().get(0);

new StaticPaymentPrintJob.Builder().paymentId(payment.getId()).order(order).build().print(getApplicationContext(), mAccount);

My example uses the first payment of an order, but you can use the Payment object returned from the Secure Pay app in onActivityResult(). Here is an example of retrieving the Payment object from Secure Pay: https://github.com/clover/android-examples/blob/ma...

Hope that helps,

Raymond

10 |2000

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

mseth avatar image
mseth answered
Thank you, that does it!
10 |2000

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