Import Orders Using the Kibo eCommerce API
You can use the Kibo eCommerce API to import existing, completed orders that you manage in an external, third-party order management system.
Because orders are tied to customer accounts, you must first import or create customer accounts in Kibo eCommerce before you can import your orders. Then, once you've imported your orders, you will need to manually update customers' lifetime value in order for customer accounts to be accurately reflected.Important: When importing orders, the Kibo eCommerce API does not fully validate order details or trigger key order workflow processes. If you plan on using any order details in other applications later such as fraud preventation appliations, Kibo eCommerce recommends you import all applicable and valid order details, including valid product and payment details associated with your orders.
Use the following overall workflow as a guide to importing your orders:
- Import customer accounts.
Since orders are tied to customer accounts, you must first import or create all applicable customer accounts. You can skip this step if you're already imported or created all applicable customer accounts in Kibo eCommerce.
- Import orders.
Importing your orders consists of mapping all relevant order details to an order resource instance, and then creating an import method that creates an instance of the order resource with all mapped details and creates the orders in Kibo eCommerce.
- Update customers' lifetime value.
Kibo eCommerce does not automatically update customers' lifetime value when you import orders so you must manually update their lifetime value after you finish importing the orders. Updating your customers' lifetime value is important for complete and accurate customer account records, especially if you perform any validation or fraud prevention using a customer's lifetime value.
Refer to the following sections for more detailed information on the above steps, as well as sample code.
1. Import Customer Accounts
Each order is inherently tied to a customer account, and because of this, you must first have all applicable customer accounts in Kibo eCommerce before importing your orders.
When you import customer accounts, it's important to also import contact information for each customer, which is required on an order object.
You can use the Kibo eCommerce Import/Export Tools to easily import < 50,000 customer records. However, if you're importing > 50,000 customer records, refer to Customer Import Code Samples for a detailed workflow to successfully import your customer records using the Kibo eCommerce API.
2. Import Orders
Once you've successfully completed importing your customers into Kibo eCommerce, you can then import your orders.
When importing your orders, you must set isImport to True and specify a customer account id on the order object.
Import Order Workflow
Use the following workflow to successfully import your orders:
- Map the following order details:
Note: If you use any systems or application downstream that interact with the imported orders, it's important that all required mappings are correct and accurate, such as product names, product codes, and payment types.
- Order Fulfillment Level Package(s) Info:
- Order Level Shipping Info:
- Order Payment Level Info:
- (Optional) Order Level Discount Info:
- Order Level Billing Info:
- Order Level Audit Info:
- Order Line Items:
- Map the order details to an order instance: Note: You must set isImport to True as well as specify a valid CustomerAccountId.
- Create an import method that performs the following actions:
- Creates an instance of the order resource.
- Maps the order details.
- Calls the CreateOrder method.
Refer to the following Gist for a complete example of the above code samples:Mozu-CS/CreateOrder.cs
3. Update Customers' Lifetime Value
A customer's lifetime value is a total monetary amount of all the orders for which they've placed and completed paying.
You can view this amount using the following two methods:
- Using Admin, go to a customer's details page and view their Lifetime Value.
- Using the Kibo eCommerce API, get a customer account, and view the commerceSummary in the response body.
Kibo eCommerce does not automatically calculate customers' lifetime value after importing orders, so once you've successfully imported your orders and mapped them to customer accounts, you must manually update your customers' lifetime value. Updating your customers' lifetime value is necessary in order for your customer accounts to be complete and accurate, as well as if you use any applications that depend on or reference a customer's lifetime value.
You can use the RecomputeCustomerLifetimeValue operation to successfully update a customer's lifetime value.
Refer to the following code sample for more information: