E-Commerce/Cart - Web Service Data Structures
Additional information on E-commerce related calls may be found at E-Commerce with external checkout via web services.
Order
The order endpoint provides access to the full order of a user.
Order (uc_order)
var uc_order = {
"uid" : 1, // The author of the order
"customer" : 1, // The uid of the user being purchased for
"delivery_address" : {
"first_name" : "Tom",
"last_name" : "Baker",
"company" : "DLC",
"street1" : "1520 Locust",
"street2" : "Suite 1000",
"city" : "Philadelphia",
"postal_code" : "19102",
"phone" : "215-321-1234",
"email" : "webservice_user@dlcdev.com"
},
"billing_address" : {
"first_name" : "Billing First",
"last_name" : "Billing Last",
"company" : "DLC",
"street1" : "1520 Locust",
"street2" : "Suite 1000",
"city" : "Philadelphia",
"postal_code" : "19102",
"phone" : "215-321-1234",
"email" : "webservice_user@dlcdev.com"
},
// Valid values: abandoned, canceled, completed, in_checkout, pending, processing, payment_received
"order_status" : "completed",
// Order total is the net value after all discounts and adjustments
"order_total" : 250.00,
"primary_email" : "webservice_user@dlcdev.com",
// This value may vary per installation.
"payment_method" : "",
"created" : "1463756400", // In Epoch format
"modified" : "1463756400", // In Epoch format
};
Order Product
An order product is an individual line item within an order. Order products are associated to an order via the order_id field. For instance, an order with two courses being purchased will have two separate order products, with varying data, but the same order_id value.
Order (uc_order_product)
var uc_order_product = {
"order_id" : 60, // The order ID
"nid" : 10, // The nid of the course being purchased
"title" : "my new course", // A place older
"model" : "course_10", // The course SKU
"qty" : 1,
"cost" : 100.00, // The internal cost
"price" : 100.00, // The price presented to learners
};
Cart Item
The cart item is a line item associated to a user's current shopping cart session. It is unrelated to an order, until the cart is processed. Each cart item is keyed to a user via the cart_id field which is the associated user's uid. A user may have multiple cart items in their session.
Cart Item (uc_cart_item)
var uc_cart_item = {
"cart_id" : 1, // The uid of the user
"nid" : 10, // The nid of the course being purchased
"qty" : 1,
};