6.6. Manage Orders#

EdX has created a framework that manages order placement and fulfillment for digital products. Most of the products that edX supports involve modifications to enrollments.

The edX framework allows modules that fulfill enrollment-related products to interact with the edX Enrollment API, which is a part of the LMS. This process can be either synchronous or asynchronous.

6.6.1. Place an Order#

To place an order, you need the following information.

  • Order number

  • User

  • Basket

  • Shipping method

  • Shipping charge

  • Billing address

  • Order total

To place an order, use the handle_order_placement() method that EdxOrderPlacementMixin provides. If you modify this code, make sure that the code collects payment before it creates order objects.

6.6.2. Fulfill Orders#

To fulfill orders, emit a post_checkout signal. An internal fulfillment API then delegates fulfillment of individual order items to the appropriate fulfillment modules.

6.6.3. About Fulfillment Modules#

The E-Commerce base fulfillment module has the following interface.



Every ProductType has a corresponding module that extends this interface and fulfills order items of that particular ProductType. To fulfill an order, the system gives each fulfillment module configured in settings (_oscar.py) an opportunity to fulfill order lines.

  • The fulfill_product method fulfills the order. For example, fulfill_product might enroll a learner in a course or upgrade the learner to a verified certificate).

  • The revoke_line method revokes a specific order line. For example, revoke_line might unenroll learners from courses or downgrade a learner from a verified seat.

6.6.4. Recover from a Fulfillment Error#

If a fulfillment operation fails, the E-Commerce service assigns the order a status indicating the reason for the failure. If you have enabled asynchronous order fulfillment, the service tries again to fulfill the order. You can also manually retry fulfillment of a failed order from the Oscar order dashboard.