Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

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.
  • discounts – List of discount codes used.
  • products – A list of products purchased. For each product:
    • id – The Product ID.
    • quantity – The cart quantity for the item.
    • 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": 123,
            "mode": "",
            "status": "publish",
            "transaction_id": 12323461261234,
            "key": "ca2aaaa2a9e9e5369b8280403431b6fd",
            "subtotal": 89,
            "tax": "0",
            "fees": null,
            "total": "8.009",
            "gateway": "manual",
            "customer_id": "2",
            "user_id": "0",
            "email": "jdoe@example.org",
            "date": "2021-09-29 13:47:41",
            "discounts": null,
            "products": [
                {
                    "id": 167,
                    "quantity": 1,
                    "name": "Stripe Pro Payment Gateway",
                    "price": 89,
                    "price_name": "Single Site"
                }
            ],
        },
        {
            "ID": 122,
            "mode": "",
            "status": "publish",
            "transaction_id": 12324621266234,
            "key": "7608c3f1b8f5e00b7f21add193ab7ced",
            "subtotal": 199,
            "tax": "0",
            "fees": null,
            "total": "199.00",
            "gateway": "manual",
            "customer_id": "2",
            "user_id": "0",
            "email": "jdoe@example.org",
            "date": "2021-09-29 13:30:59",
            "discounts": null,
            "products": [
                {
                    "id": 1245716,
                    "quantity": 1,
                    "name": "Extended Pass",
                    "price": 199,
                    "price_name": ""
                }
        }
    ]
}

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=&token=&purchasekey=

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

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

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=&token=&email=