The java client library supports the receipt API for extracting data from receipts.
Using this sample receipt below, we are going to illustrate how to extract the data that we want using the client library.
// Init a new client Client mindeeClient = new Client("<YOUR_MINDEE_API_KEY>"); // Load a file from disk and parse it ReceiptResponse receiptResponse = mindeeClient.loadDocument("./a74eaa5-c8e283b-sample_receipt.jpeg").parse(ReceiptResponse.class); // Print a summary of the parsed data logger.info(receiptResponse.documentSummary());
-----Receipt data----- Total amount including taxes: 10.2 Total amount excluding taxes: 8.5 Date: 2016-02-26 Category: food Time: 15:20 Merchant name: CLACHAN Taxes: 1.7 20.0% Total taxes: 1.7 Locale: en-GB; en; GB; GBP; ---------------------
Attributes that will be extracted from the document and available in the
- Merchant Name
- Total Taxes
- Total Inclusive of Taxes
- Total Excluding Taxes
categoryof type Field : Receipt category as seen on the receipt.
The following categories are supported: toll, food, parking, transport, accommodation, gasoline, miscellaneous.
dateof type Date : The date the receipt was issued
LocalDate receiptDate = receiptResponse.getReceipt().getDate().getValue();
timeof type Time : The time the receipt was issued
LocalTime receiptTime = receiptResponse.getReceipt().getTime().getValue();
localeof type Locale
merchantNameof type Field : Supplier name as written in the receipt.
A list of the taxes seen on the receipt
taxesof type List < Tax >
receiptResponse.getReceipt().getTaxes() .stream() .map(Tax::getTaxSummary) .forEach(System.out::println);
The total tax for the receipt
totalTaxof type Amount
The total amount including taxes for the receipt
totalInclof type Amount
The total amount excluding taxes for the receipt
totalExclof type Amount
Join our Slack
Updated 22 days ago