EDD REST API - Sales

The EDD REST API provides access to sales data via the /sales/ endpoint. The sales endpoint allows for you to query the database and retrieve information for recent sales. A basic sales query looks like this:

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

Requests to the /sales/ endpoint accept the following parameters:

  • key - The API key to authenticate the request (required).
  • token - The API token to authenticate the request (required).
  • number - The number of records to return (optional).
  • email - A search parameter to return only payments that match the given email (optional). 
  • id - The ID number of a specific payment record (optional).
  • purchasekey - The purchase key for a specific payment record (optional).

For each sale returned, the following information will be available:

  • ID - The sale ID number.
  • key -The sale purchase key.
  • subtotal - The sale subtotal.
  • tax - The sales tax amount.
  • fees - Any arbitrary fees that were added to the sale.
  • total - The total sale amount.
  • gateway - The payment method, such as stripe or paypal, used to make the purchase.
  • email - The email address associated with the sale.
  • date - The date the sale was made.
  • products - A list of products purchased. For each product:
    • name - The name of the product.
    • price - The price of the product (after any discounts).
    • price_name - The price option name that was purchased (if the product has variable prices).

An example sales query response looks like this:

{
    "sales": [
        {
            "ID": 611,
            "key": "ca2aaaa2a9e9e5369b8280403431b6fd",
            "subtotal": "20",
            "tax": 0,
            "fees": null,
            "total": "20",
            "gateway": "manual",
            "email": "johntest23@test.com",
            "date": "2013-02-25 11:42:05",
            "products": [
                {
                    "name": "Simple Notices Pro",
                    "price": "20",
                    "price_name": "Price one"
                }
            ]
        },
        {
            "ID": 607,
            "key": "7608c3f1b8f5e00b7f21add193ab7ced",
            "subtotal": "20",
            "tax": 0,
            "fees": null,
            "total": "20",
            "gateway": "manual",
            "email": "johntest23@test.com",
            "date": "2013-02-25 11:41:48",
            "products": [
                {
                    "name": "Simple Notices Pro",
                    "price": "20",
                    "price_name": "Price one"
                }
            ]
        }
    ]
}

You can narrow the results down by email by adding "&email=test@test.com". Replace "test@test.com" with the actual user's email address for whom you want to show sales.

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&email=test@test.com

Retrieving Specific Sale Records

To retrieve a specific sale record, you can include either the id or the purchasekey parameter in the request.

For example, to retrieve a sale by the purchase key, the request looks like this:

http://example.com/edd-api/sales/?key=<API key>&token=<API token>&purchasekey=<Purchase key>

To retrieve a sale by the ID, the request looks like this:

http://example.com/edd-api/sales/?key=<API key>&token=<API token>&id=<Purchase key>

Searching Sale Records

Passing the email parameter will result in the API returning all sale records that match the given email address.

http://example.com/edd-api/sales/?key=<API key>&token=<API token>&email=<email address>