Shipping

Handles actions related the customer's shipping information:

GET /account/shipping

Show the current customer's shipping information

Request

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

Responses

Success: Logged in customer with primary address and no items

{
    "status": "ok",
    "address": {
        "first_name": "Timothy",
        "last_name": "Lovett",
        "address": "111 ok street",
        "address_2": "",
        "city": "Oakland",
        "state": "CA",
        "postal_code": "94607",
        "country": "US"
    },
    "items": []
}

Success: Logged in customer with primary address and items with a selected option

{
    "status": "ok",
    "address": {
        "first_name": "Timothy",
        "last_name": "Lovett",
        "address": "111 ok street",
        "address_2": "",
        "city": "Oakland",
        "state": "CA",
        "postal_code": "94607",
        "country": "US"
    },
    "items": [
        "item_type_1": {
            "label": "T-Shirt Size",
            "options": [
                {
                    "id": 1,
                    "name": "Medium",
                    "selected": true
                },
                {
                    "id": 2,
                    "name": "Large",
                    "selected": false
                }
            ]
        }
    ]
}

Success: Logged in customer with primary address and items without a selected option

{
    "status": "ok",
    "address": {
        "first_name": "Timothy",
        "last_name": "Lovett",
        "address": "111 ok street",
        "address_2": "",
        "city": "Oakland",
        "state": "CA",
        "postal_code": "94607",
        "country": "US"
    },
    "items": [
        "item_type_1": {
            "label": "T-Shirt Size",
            "options": [
                {
                    "id": 1,
                    "name": "Medium",
                    "selected": false
                },
                {
                    "id": 2,
                    "name": "Large",
                    "selected": false
                }
            ]
        }
    ]
}

Success: Current customer with no primary address and no items associated with future subscription

{
    "status": "ok",
    "address": null,
    "items": []
}

Failure: No current customer

{
    "status": "ok",
    "address": null,
    "items": []
}

POST /account/shipping

Creates a primary address or updates the existing address on record and sets any options for the customer

Request

Name Type Description
first_name string Customer's first name
last_name string Customer's last name
address string Street address line 1
address_2 string [Optional] Street address line 2
city string City/Town
state string State/Province/Region
postal_code string Postal code
country string Country
Format: XX
item_type_x integer Option Id
{
    "first_name": "Timothy",
    "last_name": "Lovett",
    "address": "111 ok street",
    "address_2": "",
    "city": "Oakland",
    "state": "CA",
    "postal_code": "94607",
    "country": "US",
    "item_type_1": 3
}

Address Validation

If the customer does not have an address on file all of the address fields aside from address_2 are required fields in order to update the address information.

Item Type Validation

Item types are never required but can be passed to set option values. If they are passed and contain blank data a validation error will occur.

Responses

Success: Created a primary address

{
    "status": "ok",
    "address": {
        "first_name": "Timothy",
        "last_name": "Lovett",
        "address": "111 ok street",
        "address_2": "",
        "city": "Oakland",
        "state": "CA",
        "postal_code": "94607",
        "country": "US"
    },
    "items": []
}

Success: Changed country which disabled auto renewals

{
    "status": "ok",
    "address": {
        "first_name": "Timothy",
        "last_name": "Lovett",
        "address": "111 ok street",
        "address_2": "",
        "city": "Oakland",
        "state": "CA",
        "postal_code": "94607",
        "country": "CA"
    },
    "auto_renewal_disabled": true,
    "items": []
}

Failure: Trying to create an address with invalid information and setting a blank option for an item

{
    "status": "error",
    "messages": [
        "First name can't be blank", "Option name can't be blank"
    ],
    "errors": {
        "first_name": ["can't be blank"],
        "item_type_1": ["can't be blank"]
    }
}