How would I get a customer's total purchase history for the past year?

Hi, I am wondering if there is a way to get each customer’s purchase amount over the past year.

Would I need to create a database and store the customer’s purchases? Is there a way to retrieve it with a simple GET request? Thanks

:wave: With the Orders API you can SearchOrders with a query for specific customers get their order history. It would look something like this:

{
    "location_ids": [
      "{{location_id}}"
    ],
    "query": {
      "filter": {
        "customer_filter": {
          "customer_ids": [
            "{{customer_id}}"
          ]
        },
        "date_time_filter": {
          "created_at": {
            "end_at": "2022-06-16T19:29:49.582Z",
            "start_at": "2021-06-16T19:29:49.582Z"
          }
        }
      },
      "sort": {
        "sort_order": "DESC"
      }
    }
  }

:slightly_smiling_face:

1 Like