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

Recurring Payments – REST API Endpoint

Recurring Payments extends the existing RESTful API built into Easy Digital Downloads. It can be accessed at

http://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN

Note: make sure to replace example.com with your own address and the key and token values with your own.

The above example will return a list of all existing subscriptions in the store.

Input

The Recurring Payments REST API accepts 3 options besides key and token: customer, number, and paged.

Customer

The input for a customer can either be an integer representing a customer_id or an email address. The resulting URL will look similar to this:

http://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&customer=2

or

http://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&[email protected]

Number

The number option accepts an integer and returns that many results. An example would look like this:

http://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&number=5

Paged

The paged option allows you to choose a slice of a larger number. For example, if you have 100 entries, and you use number=10 you could pass paged=2 and you could get rows 11-20. That would look like this:

http://example.com/edd-api/subscriptions/?key=YOUR_API_KEY&token=YOUR_API_TOKEN&number=10&paged=2

Output

The output for each subscription contains all information about that subscription as well as about the customer and each renewal (child) payment. Additionally, there’s a value indicating the time spent getting the information for all results. Example:

{
    "subscriptions": [
        {
            "info": {
                "u0000EDD_Subscriptionu0000subs_db": {
                    "table_name": "wp_edd_subscriptions",
                    "version": "1.0",
                    "primary_key": "id"
                },
                "id": "1",
                "customer_id": "2",
                "period": "month",
                "initial_amount": "50.00",
                "recurring_amount": "50.00",
                "bill_times": "0",
                "parent_payment_id": "87",
                "product_id": "85",
                "created": "2016-03-15 15:36:30",
                "expiration": "2016-04-15 23:59:59",
                "status": "active",
                "profile_id": "paypal-363e3cc178dab152bb59b958024bce75",
                "gateway": "paypal",
                "customer": {
                    "id": "2",
                    "purchase_count": "2",
                    "purchase_value": "20.000000",
                    "email": "[email protected]",
                    "name": "Jane Doe",
                    "date_created": "2016-03-07 22:33:44",
                    "payment_ids": "16",
                    "user_id": "3",
                    "notes": [

                    ]
                }
            },
            "payments": [
                {
                    "id": 106,
                    "amount": 10.36,
                    "date": "March 21, 2016",
                    "status": "Renewal"
                },
                {
                    "id": 105,
                    "amount": 10,
                    "date": "March 21, 2016",
                    "status": "Renewal"
                },
                {
                    "id": 104,
                    "amount": 10,
                    "date": "March 21, 2016",
                    "status": "Renewal"
                }
            ]
        }
    ],
    "request_speed": 0.076335906982422
}
Read our latest blog post:
Add More Stripe Payment Methods at Checkout