Skip to main content

Kibo Commerce API Developer Guide for OMS Implementations

Understanding Order Imports in Kibo

For businesses using Kibo’s Order Management System (OMS) with a separate, external e-commerce front-end, the primary goal is not to process transactions in real-time but to import completed orders for fulfillment. In this context, an “Order” is a record of a transaction that has already occurred elsewhere. Kibo’s API is specifically designed for this. Instead of a multi-step cart-to-checkout process, you use a single, powerful API call to create a complete order record. The key is providing all necessary information—customer details, pre-calculated pricing, and pre-authorized payment details—in one request. This is achieved by using the POST /commerce/orders endpoint with the required isImport=true flag, which tells Kibo to accept the order as a historical record rather than processing it as a new transaction.

How This Domain Fits Into Kibo

The Commerce domain is the entry point for all order data into the Kibo platform. For an OMS-only implementation, this is where your external systems hand off completed sales to Kibo for subsequent management.
  • Fulfillment: Once an order is imported, it enters the Kibo fulfillment workflow, where it can be routed to the appropriate warehouse or location.
  • Customer Service: Imported orders are visible to customer service representatives, who can then manage returns, refunds, and cancellations using Kibo’s tools.
  • Inventory: Subsequent actions on an imported order, like fulfillment, will correctly decrement stock levels within Kibo.

Prerequisites

  • Kibo API credentials and basic setup
  • Node.js 16+ with TypeScript
  • Familiarity with REST APIs and constructing complex JSON objects
  • Access to pre-authorized payment transaction details from your external payment gateway.
  • API Reference: /api-overviews/openapi_overview_overview (bookmark this - you’ll reference it constantly)

What You’ll Learn

After completing this guide, you’ll understand:
  • How to structure a complete JSON payload to import an order into Kibo’s OMS.
  • The key patterns for providing pre-authorized credit card, PayPal, and other payment details.
  • How to correctly structure item-level pricing, taxes, and shipping to avoid validation errors.
  • How to include external fraud check results with an imported order.
  • How to read and navigate the official Orders API documentation for OMS-specific use cases.

Kibo OMS Import Fundamentals

How Kibo Organizes Imported Order Data

For an OMS import, you are essentially building the final Order object yourself. The core data structures you must provide are:
  • isImport: true: This boolean field is mandatory and signals to Kibo that you are importing a completed order.
  • items: An array of line items. For imported orders, you must provide the final, calculated pricing components for each item, including tax, shipping, and discounts.
  • payments: An array of payment objects. Since the payment was authorized on your external system, you must provide the gateway’s transaction details, tokenized card information, and authorization codes.
  • billingInfo: The customer’s billing address and contact information. This object must be populated on both the order level and within each payment object.
  • fulfillmentInfo: The customer’s shipping address and chosen shipping method.
  • email and customerAccountId: Identifiers for the customer.

Key Kibo Patterns You’ll See Everywhere

Authentication Pattern: The Kibo SDK manages authentication for you. You create a single Configuration object containing your credentials (Client ID, Shared Secret, etc.). This object is then passed to the constructor of the OrderApi client, which handles the OAuth 2.0 token exchange for every API call. Error Handling Approach: Kibo provides structured errors. For OMS imports, the most common error is a VALIDATION_ERROR, often with a message like “The order totals do not match the sum of the item totals.” This means you must carefully verify your pricing calculations.
API Documentation Reference: The primary endpoint for this guide is POST /commerce/orders.
Find complete specs at: Create Order

Importing an Order: The Kibo OMS Way

When You Need This

This is the core workflow for any OMS-only Kibo client. You use this process to feed orders from your website, mobile app, or other point-of-sale systems into Kibo for centralized fulfillment and management.

API Documentation Reference

Endpoint: POST /commerce/orders
Method: POST
API Docs: Create Order

Understanding the Kibo Approach

Kibo’s import functionality is built on trust. By setting isImport=true, you are telling the system: “Trust me. This transaction is complete, the payment is authorized, and the prices are final.” Kibo will bypass its internal pricing and payment processing engines and instead record the exact data you provide. This makes the accuracy of your payload important, especially the financial details. The sum of all item-level pricing components must precisely match the overall order total.

Code Structure Walkthrough

We’ll build this step by step:
  1. Configuration: Create a central Configuration instance.
  2. API Client Instantiation: Create a dedicated client for the Order API.
  3. Data Preparation: Meticulously construct the entire Order object, including items with broken-down pricing and payments with gateway authorization details.
  4. API Call: Use the createOrder method to import the order.

Step-by-Step Implementation

Step 1: Setting Up the Foundation
Step 2: The Core Implementation This example shows how to import an order with a pre-authorized Cybersource credit card payment.

Advanced Import Patterns

Pattern 1: Importing an Order with a PayPal Payment

Business Scenario: Your website uses PayPal Express 2. You need to import the completed order into Kibo, including the necessary PayPal transaction details so you can capture funds later. Kibo’s Architecture Consideration: Kibo has a specific structure for PayPal Express 2 payments. You must provide the payerId, the externalTransactionId (which is the PayPal EC- token), and the gatewayTransactionId from the authorization.

Pattern 2: Importing an Order with Fraud Review

Business Scenario: Your e-commerce front-end uses a service like Kount for fraud detection. An order is flagged for manual review. You need to import this order into Kibo and ensure it is also placed in a “Pending Review” state. Kibo’s Architecture Consideration: You can pass external fraud results directly into the order payload using the validationResults object. By setting the status within this object to Review, Kibo will automatically place the imported order into a Pending status, preventing it from being fulfilled until it is manually accepted.

Troubleshooting Your OMS Import

Common Import Issues

Issue 1: The createOrder call fails with a VALIDATION_ERROR and a “totals do not match” message.
  • Why it happens: This is the most common import error. The sum of all item-level pricing fields (discountTotal, itemTaxTotal, shippingTotal, shippingTaxTotal, handlingAmount, etc.) across all items does not exactly equal the top-level order.total. This often happens due to floating-point math rounding errors or misinterpreting which fields are additive.
  • How to fix it: Before sending the request, programmatically sum all the calculated pricing fields from your items array and ensure the result is used to set order.total, order.subtotal, order.taxTotal, etc. Do not assume they will be calculated for you.
Issue 2: The order is imported, but subsequent payment capture fails.
  • Why it happens: The authorization details provided in the payment.interactions object were incorrect or insufficient. For gateways like Cybersource or Authorize.net, specific keys and tokens from the original authorization are required to link a future capture or credit action.
  • How to fix it: Double-check the required gatewayResponseData for your specific payment gateway. Ensure you are storing and passing the correct transaction IDs, request tokens, and auth codes from your e-commerce front-end’s payment authorization step. Make sure you are correctly mapping gateway fields, such as CustomerProfileId to cardNumberPartOrMask for Authorize.net.