question

anandd-1991 avatar image
anandd-1991 asked Emily L answered

Clover Sales Reports

We are building a custom loyalty app and would like to get the following fields:

Product Name
Sale Date
UPC and SKU #
Price (Sale/Retail)
Quantity Purchased
Total Amount

How can I do that? The API documentation does not give any kind of information on this. Please assist
Clover Android SDKclover developer communityClover Station
10 |2000

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

1 Answer

Emily L avatar image
Emily L answered
There is no prepackaged way to get all of these fields together, but you should be able to find what you need by exploring the Clover Android SDK ( https://clover.github.io/clover-android-sdk/). You would also have to do some data processing on your end putting the different pieces together, but here’s how I’d suggest getting started:

  • Since you’re making a loyalty app, you probably want to connect your requested fields to specific customers. You can use CustomerConnector to get customer data: once you have a specific customer in mind, you can use their ID with CustomerConnector’s getCustomer(String id) method.
  • Using getOrders() on a Customer returns a list of Orders the customer has made. When you look at each order, you can get the time the order was created and the order total, which you can add to a running total if you want to know the total a customer has spent.
  • However, these Orders are from the v1 SDK and some of the data you want is more readily available to v3 Orders. Using OrderConnector lets you return a v3 Order from the order’s ID: com.clover.sdk.v3.order.Order v3Order = yourOrderConnector.getOrder(yourV1Order.getId());
  • The reason why you want a v3 Order is that now you can use getLineItems(), which will help you find a lot of your data. By going through the line items, you can find the names of the items the customer purchased, the price the customer paid, and you can keep track of and increment the quantity purchased as you go.
  • All that’s left from your list is the UPC and SKU, which will require another connector. While we can use getItem() on our LineItems, all that returns is a Reference with the item ID. We have to plug that ID into InventoryConnector’s getItem() method to get information about an inventory item. Items have the methods getCode() for the UPC and getSku() for the SKU.

To simplify, take a look at the different connectors like CustomerConnector, OrderConnector, and InventoryConnector, see what sorts of objects they return, and what information those objects store.

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