When customers purchase products from a site’s store an order is created. An order contains order items that represent the products the customer purchased. Orders can have one or more shipments and shipment transactions that show the charges for shipping. Orders also include billings, which are the payment methods and billing addresses, as well as billing transactions which are the actual charges.

Orders can also be associated with coupons and discounts used with the order, as well as notes that the customer may have left for the store owner.

Fields

The following table shows all fields that exist for this API and those that are returned when you retrieve a list. All fields are returned when you retrieve a single item.

Name Description Type List
user_id The unique ID of the authenticated user string X
site_id ID of a Weebly site, unique to the currently authenticated user​ string X
order_id The unique order id (within the store) of the order. string X
order_date The date that the order was placed. Unix timestamp in GMT X
full_name ​Full name of the person who placed the order, as entered during checkout. string X
is_marketing_updates_subscribed Whether or not the customer of this order elected to receive marketing updates.
Valid values are:
  • true
  • false
boolean
order_status The order status.
Valid values are:
  • pending
  • paid
  • shipped
  • cancelled
  • refunded
  • sent (for use with digital products)
  • returned
  • completed (for use with service products)
string X
order_currency ​Currency used for this order string X
order_item_tax_total Total tax charged for all items decimal
order_tax_total ​Total tax charged for this order decimal
order_tax_rates An object that breaks down the total_tax for the order into an array of the different tax rates for the order. For example, an order that has both state and local taxes charged on a $100 order might have this:
{
    "total_tax": 8.50,
    "rates": [
        {
            "name": "State",
            "rate": 0.075,
            "amount":7.5
        },
        {
            "name": "City",
            "rate": 0.010,
            "amount": 1.0
        }
     ]
}
object
order_shipping_total ​Total amount of shipping charged for this order. decimal
order_shipping_taxes_total ​Total amount of tax charged against shipping. integer
order_shipping_subtotal ​Amount of shipping charged before any shipping tax. integer
order_shipping_method The method used to ship the order. These are defined by the store owner when they configure their shipping rates. string
order_subtotal Amount of order before taxes and shipping charges. decimal
order_total ​Amount of order, including taxes and shipping charges. integer X
order_notes Notes entered by the customer when the order was placed. string
items An array of order items. array
shipments An array of order shipments array
billings An array of order billings array
coupons An array of coupons array
created_date Date the order was created Unix GMT Timestamp
updated_date Date the order was last updated Unix GMT Timestamp

GET
Retrieve a List of Orders

GET /v1/user/sites/{SITE_ID}/store/orders

Returns all orders for the given site. Only list fields are returned.


scope: read:store-orders

Query Parameters

Returned values are paginated. You can further filter results using these parameters:

Parameter Description Type
page Which page of results to return. Start is 1. integer
limit Number of results per page to return. Default is 25.
Max is 200.
integer
query Use to retrieve only pages that have a full-text match with the query string. string
filterby Field name to set a filter on. string
filterfor ​​​Value to search the filterby field for.
You can use the following URL encoded operators with your filterfor parameter:
  • ​<: use %3C
  • >: use %3E
  • <=: use %3C%3D
  • >=: use %3E%3D
string
sortby Field name to sort by. You can sort on order_date. string
sortdir Sort direction. Valid values are:
  • asc
  • desc
string

Example CURL request returning all orders:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example filtered request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders?sortby=order_date&sortdir=asc \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "963728582",
        "order_date": 1415061315,
        "full_name": "Jane Doe ",
        "order_status": "pending",
        "order_currency": "USD",
        "order_total": 2
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "989398230",
        "order_date": 1443305684,
        "full_name": "John Smith ",
        "order_status": "shipped",
        "order_currency": "USD",
        "order_total": 4
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "997590262",
        "order_date": 1443389596,
        "full_name": "John Doe ",
        "order_status": "pending",
        "order_currency": "USD",
        "order_total": 6
    }
]

GET
Retrieve the Number of Orders for a Site

GET /v1/user/sites/{SITE_ID}/store/orders/count

Returns the number of non-deleted orders.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/count \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

{
    "count": 9
}

GET
Retrieve Details for an order

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}

Returns all fields for the given order.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/997590262 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the order are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "order_id": "997590262",
    "order_date": 1443305684,
    "full_name": "Jane Doe",
    "is_marketing_updates_subscribed": false,
    "order_status": "pending",
    "order_currency": "USD",
    "order_item_tax_total": 8.50,
    "order_tax_total": 8.50,
    "order_tax_rates": {
    "total_tax": 8.50,
    "rates": [
        {
            "name": "State",
            "rate": 0.075,
            "amount":7.5
        },
        {
            "name": "City",
            "rate": 0.010,
            "amount": 1.0
        }
    ]
    },
    "order_shipping_total": 3,
    "order_shipping_taxes_total": 0,
    "order_shipping_subtotal": 3,
    "order_shipping_method": "USPS",
    "order_subtotal": 3,
    "order_total": 6,
    "order_notes": null,
    "created_date": 1442892536,
    "updated_date": 1443548303,
    "items": [
        {
            "discounted_price": 2,
            "track_inventory": true,
            "order_id": "997590262",
            "order_item_id": "1",
            "site_product_id": "2",
            "site_product_sku_id": 2,
            "name": "T-shirt",
            "short_description": "100% Cotton",
            "quantity": 1,
            "product_type": "physical",
            "download_limit_type": null,
            "download_units_remaining": null,
            "price": 10,
            "sale_price": 8,
            "total_price": 8,
            "weight": 1,
            "weight_unit": "lb",
            "sku": null,
            "options": {
                "Color": "red",
                "Size": "small"
            },
            "returned": null,
            "discounts": [
                {
                    "discount_type": "markdown",
                    "price": 2,
                    "discount": 0
                }
            ],
            "original_product_url": "http://mystore.weebly.com/store/p2/tshirt.html",
            "user_id": "123456",
            "site_id": "987654321",
            "created_date": 1442892536,
            "updated_date": 1442892536
        },
        {
            "discounted_price": 1,
            "track_inventory": true,
            "order_id": "997590262",
            "order_item_id": "2",
            "site_product_id": "1",
            "site_product_sku_id": 1,
            "name": "Sticker",
            "short_description": "Iron on sticker",
            "quantity": 1,
            "product_type": "physical",
            "download_limit_type": null,
            "download_units_remaining": null,
            "price": 1,
            "sale_price": null,
            "total_price": 1,
            "weight": 1,
            "weight_unit": "lb",
            "sku": " ghjktyu t",
            "options": {
                "color": "rainbow"
            },
            "returned": null,
            "discounts": [],
            "original_product_url": "http://mystore.weebly.com/store/p1/sticker.html",
            "user_id": "123456",
            "site_id": "987654321",
            "created_date": 1443295500,
            "updated_date": 1443295500
        }
    ],
    "shipments": [
        {
            "order_id": "997590262",
            "order_shipment_id": 1,
            "shipping_provider": "USPS",
            "weight": 2,
            "weight_unit": "lb",
            "height": 3,
            "width": 4,
            "depth": 5,
            "full_name": "Jane Doe",
            "email": "jane.doe@email.com",
            "phone": "555-555-5555",
            "business_name": null,
            "street": "460 Bryant St",
            "street2": null,
            "city": "San Francisco",
            "region": "CA",
            "country": "US",
            "postal_code": "94107",
            "shipment_tax_total": 0,
            "shipment_tax_rates": null,
            "price": 3,
            "shipment_total": 3,
            "charge_taxes_on_shipping": false,
            "title": "USPS",
            "shipment_date": null,
            "tracking_number": 123331,
            "status": "shipped",
            "user_id": "123456",
            "site_id": "987654321",
            "created_date": 1443305683,
            "updated_date": 1443547605,
            "transactions": [
                {
                    "order_id": "997590262",
                    "order_shipment_id": 1,
                    "order_shipment_transaction_id": 1,
                    "tx_id": "123331",
                    "tx_type": "USPS",
                    "tx_date": 1443547605,
                    "tx_status": "shipped",
                    "user_id": "123456",
                    "site_id": "987654321",
                    "created_date": 1443547605,
                    "updated_date": 1443547605
                },
                {
                    "order_id": "997590262",
                    "order_shipment_id": 1,
                    "order_shipment_transaction_id": 2,
                    "tx_id": "123331",
                    "tx_type": "USPS",
                    "tx_date": 1443548303,
                    "tx_status": "label_returned",
                    "user_id": "123456",
                    "site_id": "987654321",
                    "created_date": 1443548303,
                    "updated_date": 1443548303
                }
            ]
        }
    ],
    "billings": [
        {
            "order_id": "997590262",
            "order_billing_id": 1,
            "gateway": "Stripe",
            "full_name": "Jim Doe",
            "email": "jim.doe@email.com",
            "phone": null,
            "business_name": null,
            "street": null,
            "street2": null,
            "city": null,
            "region": null,
            "country": null,
            "postal_code": "94107",
            "user_id": "123456",
            "site_id": "987654321",
            "created_date": 1443305683,
            "updated_date": 1443305683,
            "transactions": [
                {
                    "order_id": "997590262",
                    "order_billing_id": 1,
                    "order_billing_transaction_id": 1,
                    "method": "purchase",
                    "status": "success",
                    "amount": 600,
                    "currency": "USD",
                    "tx_fee": 0,
                    "tx_id": "ch_16pQwKKRCoO7IeaF6wfR7gBB",
                    "tx_message": "Transaction approved",
                    "cc_type": "Visa",
                    "cc_last_4": "4242",
                    "user_id": "123456",
                    "site_id": "987654321",
                    "created_date": 1443305683,
                    "updated_date": 1443305684
                }
            ]
        }
    ],
    "coupons": []
}

Help make these docs better!









Tags: