What is the Lifecycle of an Order?

This topic provides an overview of how you might implement your site code to process customer orders. The description provided here is not the only way to process orders, but rather is intended to introduce key orders classes and concepts. Furthermore, the topic includes only the details that are relevant to the Orders System. When a customer logs in to your Web site, for example, your site code would do more than the orders-related actions described in this topic.

The following table describes the steps that your site code might execute in response to a series of customer actions.

Customer action

Site code

Add the first item to the shopping cart.

  1. Create a Basket object.

  2. Create an OrderForm object.

  3. Create a LineItem object.

  4. Set properties on the LineItem object to represent quantity, SKU, etc.

  5. Add the LineItem object to the OrderForm object.

  6. Add the OrderForm object to the Basket object.

Add another item to the shopping cart.

  1. Create a LineItem object.

  2. Set properties on the LineItem object to represent quantity, SKU, etc.

  3. Add the LineItem object to the OrderForm object on the Basket object.

Log in to the Web site.

  • Set the SoldToId property on the Basket object to indicate the customer's ID.

Check out.

  1. Gather shipment information from the customer, such as how many shipments to make, where to ship items, and by which method to ship.

  2. Gather payment information from the customer, such as how much to pay and by which method to pay.

  3. Gather discount information from the customer, such as promotion codes.

  4. Run the Basket pipeline:

    1. Get data about each LineItem object from the catalog and add it to the LineItem object.

    2. Remove LineItem objects for products that are no longer available.

    3. Apply discounts, and add PromoCodeRecord objects to the Basket object to represent the discounts.

  5. Run the Total pipeline:

    1. Create Shipment objects and add them to the Basket object.

    2. Apply shipping discounts, and add PromoCodeRecord objects to the Basket object to represent the shipping discounts.

    3. Set properties on the Basket object to represent the total cost and the components of the cost such as tax, shipping, etc.

  6. Run the Checkout pipeline:

    1. Create Payment objects and add them to the Basket object.

    2. Authorize each payment by using a third-party authorization component.

    3. Record that the discounts have been redeemed.

    4. Update the inventory of the items that the customer purchased.

  7. Convert the Basket object to a PurchaseOrder object.

See Also

Other Resources

Orders Runtime Object Model

Orders System Scenarios

Developing with the Orders System