Orders

These resources show orders associated with the current customer

GET /orders

List all completed orders associated with the current customer

Request

Name Type Description
order string [Optional] Sorts orders by id either ascending (ASC) or descending (DESC)
Defaults to ASC
{
    "order": "DESC"
}

Responses

Success: All orders for the current customer, sorted by id descending

{
    "status": "ok",
    "orders": [
        {
            "id": 3,
            "customer_id": 2,
            "plan": {
                "id": 1,
                "name": "Plan Name 3",
                "class": "plan-name-3",
                "description": "<p>Plan description or else nil</p>",
                "online_benefits": "<p>Plan online benefits or else nil</p>",
                "annotations": "<p>Plan annotations or else nil</p>",
                "tags": [],
                "duration": 12,
                "display_price": "Free",
                "upgrade_price": nil,
                "price": 0,
                "checkout": "http://test.host/checkout/3?url=2",
                "current": false,
                "upgrade": false,
                "available_to_customer": true,
                "package": {}
            },
            "totals": nil,
            "created_at": "January 30, 2013",
            "paid_at": "January 30, 2013",
            "refunded_at": nil
        },
        {
            "id": 2,
            "customer_id": 2,
            "plan": {
                "id": 2,
                "name": "Plan Name 2",
                "class": "plan-name-2",
                "description": "<p>Plan description or else nil</p>",
                "online_benefits": "<p>Plan online benefits or else nil</p>",
                "annotations": "<p>Plan annotations or else nil</p>",
                "tags": [],
                "duration": 12,
                "display_price": "$50.00",
                "upgrade_price": nil,
                "price": 50,
                "checkout": "http://test.host/checkout/2?url=2",
                "current": false,
                "upgrade": false,
                "available_to_customer": true,
                "package": {
                    "name": "Package 2",
                    "description": "Package description",
                    "shipping_and_handling": {
                        "domestic": "5.0",
                        "international": "11.0"
                    },
                    "items": []
                }
            },
            "totals": {
                "shipping": "10.0",
                "discount": "5.0",
                "subtotal": "50.0",
                "total": "55.0"
            },
            "created_at": "January 30, 2013",
            "paid_at": "January 30, 2013",
            "refunded_at": nil,
            "shipments": [{
                "status": "Shipped on Jaunary 1, 2013",
                "ship_date": "2013-01-01",
                "tracking_url": "https://tools.usps.com/id=9269876",
                "items": 3
            }]
        }
    ]
}

Success: All orders for the current customer with queued shipments

{
    "status": "ok",
    "orders": [
        {
            "id": 2,
            "customer_id": 2,
            "plan": {
                "id": 2,
                "name": "Plan Name 2",
                "class": "plan-name-2",
                "description": "<p>Plan description or else nil</p>",
                "online_benefits": "<p>Plan online benefits or else nil</p>",
                "annotations": "<p>Plan annotations or else nil</p>",
                "tags": [],
                "duration": 12,
                "display_price": "$50.00",
                "upgrade_price": nil,
                "price": 50,
                "checkout": "http://test.host/checkout/2?url=2",
                "current": false,
                "upgrade": false,
                "available_to_customer": true,
                "package": {
                    "name": "Package 2",
                    "description": "Package description",
                    "shipping_and_handling": {
                        "domestic": "5.0",
                        "international": "11.0"
                    },
                    "items": []
                }
            },
            "totals": {
                "shipping": "10.0",
                "discount": "5.0",
                "subtotal": "50.0",
                "total": "55.0"
            },
            "created_at": "January 30, 2013",
            "paid_at": "January 30, 2013",
            "refunded_at": nil,
            "shipments": [{
                "status": "Backordered",
                "issues": ["missing_shipment_address"]
            }]
        }
    ]
}

GET /orders/{id}

Show specific completed order details for the current customer

Request

Name Type Description
id url segment [Required] The ID of the desired order

No parameters required (besides your API key of course).

Responses

Success: After GET request to /orders/489

{
    "status": "ok",
    "order": {
        "id": 489,
        "customer_id": 164,
        "plan": {
            "id": 3,
            "name": "Plan Name 30",
            "class": "plan-name-30",
            "description": "<p>Plan description or else nil</p>",
            "online_benefits": "<p>Plan online benefits or else nil</p>",
            "annotations": "<p>Plan annotations or else nil</p>",
            "tags": [],
            "duration": 12,
            "display_price": "$50.00",
            "upgrade_price": nil,
            "price": "50.0",
            "checkout": "http://test.host/checkout/509?url=144",
            "current": false,
            "upgrade": false,
            "available_to_customer": true,
            "package": {
                "name": "Package 23",
                "description": "Package description",
                "shipping_and_handling": {
                    "domestic": "5.0",
                    "international": "11.0"
                },
                "items": []
            }
        },
        "totals": {
            "shipping": "10.00",
            "discount": "5.00",
            "subtotal": "50.00",
            "total": "50.00"
        },
        "created_at": "January 30, 2013",
        "paid_at": "January 30, 2013",
        "refunded_at": nil,
        "billing_address": {
            "first_name": "Joe",
            "last_name": "Jackson",
            "address": "123 Fake St. Suite 11",
            "address_2": "",
            "city": "Oakland",
            "state": "CA",
            "postal_code": "94612",
            "country": "US"
        },
        "shipments": [{
            "status": "Shipped on Jaunary 1, 2013",
            "ship_date": "2013-01-01",
            "tracking_url": "https://tools.usps.com/id=9269876",
            "shipping_address": {
                "first_name": "Naveen",
                "last_name": "Jain",
                "address": "2201 Broadway",
                "address_2": "",
                "city": "Oakland",
                "state": "CA",
                "postal_code": "94612",
                "country": "US"
            },
            "items": [{
                "name": "Item 1",
                "thumbnail": nil,
                "option": "Option 1"
            }]
        }]
    }
}

Success: After GET request to /orders/489 with queued shipments

{
    "status": "ok",
    "order": {
        "id": 489,
        "customer_id": 164,
        "plan": {
            "id": 3,
            "name": "Plan Name 30",
            "class": "plan-name-30",
            "description": "<p>Plan description or else nil</p>",
            "online_benefits": "<p>Plan online benefits or else nil</p>",
            "annotations": "<p>Plan annotations or else nil</p>",
            "tags": [],
            "duration": 12,
            "display_price": "$50.00",
            "upgrade_price": nil,
            "price": "50.0",
            "checkout": "http://test.host/checkout/509?url=144",
            "current": false,
            "upgrade": false,
            "available_to_customer": true,
            "package": {
                "name": "Package 23",
                "description": "Package description",
                "shipping_and_handling": {
                    "domestic": "5.0",
                    "international": "11.0"
                },
                "items": []
            }
        },
        "totals": {
            "shipping": "10.00",
            "discount": "5.00",
            "subtotal": "50.00",
            "total": "50.00"
        },
        "created_at": "January 30, 2013",
        "paid_at": "January 30, 2013",
        "refunded_at": nil,
        "billing_address": {
            "first_name": "Joe",
            "last_name": "Jackson",
            "address": "123 Fake St. Suite 11",
            "address_2": "",
            "city": "Oakland",
            "state": "CA",
            "postal_code": "94612",
            "country": "US"
        },
        "shipments": [{
            "status": "Backordered",
            "issues": ["missing_required_option"],
            "shipping_address": {
                "first_name": "Naveen",
                "last_name": "Jain",
                "address": "2201 Broadway",
                "address_2": "",
                "city": "Oakland",
                "state": "CA",
                "postal_code": "94612",
                "country": "US"
            }
        }]
    }
}

Failure: Order doesn't belong to current customer

{
    "status": "error",
    "messages": ["No order found"]
}

Shipment Issues

Issue Description
missing_shipment_address The order being processed is missing a shipping address and the customer does not have a primary shipping address on file.
missing_required_option Customer is missing option required for package associated with the shipment and must provide one prior to the shipment's processing.

GET /orders/latest

Shows the latest completed order details for the current customer

Request

No parameters required (besides your API key of course).

Responses

Success: Assuming order with ID = 489, the response will be identical the one above

Failure: Customer has no orders

{
    "status": "error",
    "messages": ["No order found"]
}