Create dashboard of orders and invoices

I am looking to create a dashboard for us to track all orders that are places on our site as well as the invoices that are created. I tried using the SearchOrders API and it doesn’t appear to return customer data. Just the line items order details. I need to get the customer data including address, order line items. I will then call the invoices API to hopefully get the paid invoices and unpaid invoices so that I can have all the latest orders/invoices data in one place for our delivery drivers to see what needs to go out.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Orders API: How It Works
Retrieve, List, or Search Invoices
Create Orders

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To achieve this, you would need to use a combination of the Orders API and the Customers API.

When you call the SearchOrders API, it returns the order details including the ‘customer_id’ field. You can then use this ‘customer_id’ to make a call to the RetrieveCustomer endpoint in the Customers API. This will give you the customer’s details including their address.

For the invoices, you can use the ListInvoices endpoint in the Invoices API to get a list of all invoices for a specific location. This will include both paid and unpaid invoices. Each invoice also includes a ‘customer_id’ field which you can use to retrieve customer details as described above.

By combining the data from these API calls, you should be able to create a comprehensive dashboard with all the information you need.

This answer was reviewed by @Bryan-Square.

If I have 300 customers in my Square customer directory and I need to retrieve customer details for 10-20 orders what is the most performant route? Should I call RetrieveCustomer 10-20 times for all the orders OR should I call listCustomers to get all 300 customers and then find each of the 10-20 customers details within that result? I use Node.

You can definitely call RetrieveCustomer with the customer_id for each order. :slightly_smiling_face: