CommercEngine POS Admin API

website·Indexed 32 days ago

https://llm-docs.commercengine.io

API documentation for CommercEngine POS administration, featuring endpoints for managing orders, customers, inventory, and shipments. Includes detailed OpenAPI specifications and TypeScript definitions for retrieving order invoices, receipts, shipment activities, and customer loyalty details.

Tokens
163.7K
Snippets
748
Records
1K
Agent score
56%

What's inside CommercEngine

  1. Retrieve POS user details

    Use the getUser method to fetch information about a specific POS user by their ID. This corresponds to a GET request to /pos/users/{id}.
    const user = await posSdk.getUser('user_id');
  2. ShipmentItem schema definition

    The ShipmentItem schema represents a shipment item model. It contains details about the product, its specific variant, the SKU, and quantity information, including whether the item is provided for free.
    interface ShipmentItem {
        product_id?: string;
        product_name?: string;
        product_image_url?: string | null;
        variant_id?: string;
        variant_name?: string;
        sku?: string;
        quantity?: number;
        free_quantity?: number;
        is_free_item?: boolean;
    }
  3. OrderList schema definition

    The OrderList schema represents the order list model. It contains comprehensive details about a customer's order, including identification, financial totals, fulfillment types, and associated customer and address information.
    type OrderList = {
        /** Order id. Same as order number. */
        id: string;
        /** Unique number associated with the order. */
        order_number: string;
        /** Date and time when the order was placed. Format: date-time */
        order_date: string;
        status: OrderStatus;
        payment_status: PaymentStatus;
        /** Date and time when the payment for the order was successfully processed. */
        payment_success_date: string | null;
        /** Fulfillment method */
        fulfillment_type: "collect-in-store" | "delivery";
        /** Indicates whether the order includes subscription items. */
        on_subscription: boolean;
        /** Total amount for the order, including all items, taxes, and discounts. Format: double */
        grand_total: number;
        /** Number of loyalty points redeemed in the order. Format: double */
        loyalty_point_redeemed: number;
        /** Amount of credit balance used in the order. Format: double */
        credit_balance_used: number;
        /** Amount remaining to be paid for the order. Format: double */
        to_be_paid: number;
        /** Total count of items included in the order. */
        order_items_count: number;
        order_items: OrderItem[];
        customer_id: string;
        customer_note: string | null;
        billing_address: CustomerAddress;
        shipping_address: CustomerAddress;
        /** Format: double */
        loyalty_point_earned: number;
        coupon_code: string | null;
        currency: {
            name: string;
            code: string;
            symbol: string;
        };
        sales_channel?: {
            id: string;
            name: string;
            type: string;
        };
        metadata?: { [key: string]: string };
        /** Format: date-time */
        created_at: string;
        /** Format: date-time */
        modified_at: string;
    };
  4. ShipmentInfo schema definition

    The ShipmentInfo schema represents detailed information about a shipment, including order identifiers, warehouse details, shipping costs, courier information, and delivery timelines. It includes a nested slo object to track Service Level Objective performance (on-time, delay, or early).
    interface ShipmentInfo {
        order_number: string;
        order_status: string;
        shipment_number: string;
        warehouse_id: string;
        warehouse_name: string | null;
        status: ShipmentStatus; // Resolves to components["schemas"]["ShipmentStatus"]
        total_weight: number;
        total_boxes: number | null;
        shipment_items_count: number;
        shipping_estimated_cost: number; // Format: double
        shipping_discount_amount: number; // Format: double
        shipping_amount: number; // Format: double
        shipping_tax_rate: number; // Format: double
        shipping_tax_amount: number; // Format: double
        shipping_amount_including_tax: number; // Format: double
        shipping_provider_id: string | null;
        shipping_provider_name: string | null;
        courier_company_id: string | null;
        courier_company_name: string | null;
        courier_company_image_url: string | null;
        awb_no: string | null;
        shipping_label_url: string | null;
        eta_delivery: string | null;
        estimated_delivery_date: string | null;
        promised_delivery_date: string | null;
        out_for_delivery_date?: string | null;
        shipped_date: string | null;
        delivered_date: string | null;
        returned_date: string | null;
        fulfillment_type: "delivery" | "collect-in-store";
        slo: {
            expected_date?: string; // Format: date
            actual_date?: string; // Format: date
            difference?: string;
            slo_status?: "on-time" | "delay" | "early";
        };
        cancellation_reason: string | null;
        customer_id: string;
        customer_name: string;
        shipping_address_line1: string;
        shipping_address_line2: string | null;
        shipping_landmark: string | null;
        shipping_pincode: string;
        shipping_city: string;
        shipping_state: string;
        created_at: string;
        modified_at: string;
    }
  5. Use the AppliedCoupon schema for cart and order coupons

    The AppliedCoupon schema provides details about an active coupon applied to a cart or order. It tracks the specific coupon ID, the type of promotion being applied, the total savings, and optional product/variant associations if the coupon is specific to certain items.
    interface AppliedCoupon {
      coupon_id: string;
      /** @enum {unknown} */
      coupon_type: "discount" | "free-goods" | "fixed-price" | "free-shipping" | "buy-x-get-y" | "volume-based" | "accelerated-rewards";
      savings: number;
      product_id: string | null;
      variant_id: string | null;
      product_name: string | null;
      variant_name: string | null;
    }
  6. Understand the AppliedPromotion schema

    The AppliedPromotion schema provides details about an active promotion that has been applied to a cart or order. It tracks the type of promotion, the total savings, and the specific product or variant it applies to if applicable.
  7. OrderReturnDetail schema definition

    The OrderReturnDetail schema is used to represent detailed information about an order return. It extends the base OrderReturn schema and adds specific properties for tracking the return process, including the associated return order, any replacement orders, refund details, and supporting media attachments.
    OrderReturnDetail: {components["schemas"]["OrderReturn"] & {
                return_order?: components["schemas"]["OrderReturnOrder"] | null
    }
  8. Use the OrderItem schema for order line items

    The OrderItem schema represents an individual item within an order. It contains detailed information about the product, its pricing, tax calculations, subscription status, and fulfillment details.

    Key properties include:

    • Product Identification: product_id, product_name, sku, slug, and optional variant_id/variant_name.
    • Product Type: Categorized as physical, digital, or bundle via the product_type field.
    • Fulfillment: The backorder boolean indicates if the item is out of stock and will ship later, which may result in split shipments.
    • Pricing & Tax: Includes selling_price, listing_price, tax_amount, and specific handling charges. The tax_type is constant as GST.
    • Subscriptions: Tracks if an item is on subscription via on_subscription, including the subscription_plan, subscription_interval, and subscription_frequency.
    • Marketplace Data: seller_id and seller_detail are only populated for marketplace-type stores; they return null for B2B and B2C stores.
    OrderItem: {
        product_id: string;
        product_name: string;
        product_image_url: string | null;
        product_type: "physical" | "digital" | "bundle";
        sku: string;
        slug: string;
        variant_id: string | null;
        variant_name: string | null;
        backorder: boolean;
        on_promotion: boolean;
        on_subscription: boolean;
        subscription_plan: string | null;
        subscription_interval: number | null;
        subscription_frequency: string | null;
        quantity: number;
        free_quantity: number;
        is_free_item: boolean;
        price_including_tax: boolean;
        selling_price: number;
        listing_price: number;
        selling_price_excluding_tax: number;
        promotion_discount_amount: number;
        coupon_discount_amount: number;
        tax_type: "GST";
        tax_rate: number;
        tax_amount: number;
        handling_charge_excluding_tax: number;
        handling_charge_tax_rate: number;
        handling_charge_including_tax: number;
        associated_options?: components["schemas"]["AssociatedOption"] | null;
        attributes?: components["schemas"]["ProductAttribute"][];
        seller_id?: string | null;
        seller_detail?: components["schemas"]["SellerInfo"] | null;
    };
  9. Retrieve shipment details using the POS SDK

    Use the pos.getShipment() method to retrieve detailed information about a shipment. You must provide the reference_number of the shipment as a parameter. The response contains a content object with a shipment property of type ShipmentDetail, which includes the order number, a list of shipments (with status, AWB number, and courier name), and shipment items.
    const { data, error } = await pos.getShipment({
      reference_number: "SHIP-2024-001234"
    });
    
    if (error) {
      console.error("Failed to get shipment:", error.message);
    } else {
      const shipment = data.content?.shipment;
      console.log(`Order: ${shipment?.order_number}`);
      console.log(`Shipments:`, shipment?.shipments);
      shipment?.shipments?.forEach(s => {
        console.log(`  Shipment: ${s.shipment_number} - Status: ${s.status}`);
        console.log(`  AWB: ${s.awb_no} - Courier: ${s.courier_company_name}`);
        console.log(`  Items:`, s.shipment_items);
      });
    }
  10. Retrieve customer details using the POS SDK

    Use the pos.getCustomer() method to retrieve detailed information about a specific customer, including their full name, email, phone number, and loyalty program data (points balance and lifetime spend). This method corresponds to the GET /pos/customers/{id} endpoint.
    const { data, error } = await pos.getCustomer({
      id: "01H9CUST12345ABCDE"
    });
    
    if (error) {
      console.error("Failed to get customer:", error.message);
    } else {
      const customer = data.content?.customer;
      console.log(`Customer: ${customer?.full_name}`);
      console.log(`Email: ${customer?.email}`);
      console.log(`Phone: ${customer?.phone}`);
      console.log(`Loyalty points: ${customer?.loyalty?.points_balance}`);
      console.log(`Total spent: ${customer?.loyalty?.lifetime_spent}`);
    }
  11. IfscDetail schema definition

    The IfscDetail schema represents detailed information about a bank branch identified by its Indian Financial System Code (IFSC). It includes geographic details, bank identification, and supported payment systems like IMPS, NEFT, RTGS, and UPI.
    interface IfscDetail {
        address: string;
        bank: string;
        bankcode: string;
        branch: string;
        centre: string;
        city: string;
        contact: string;
        district: string;
        ifsc: string;
        imps: boolean;
        iso3166: string;
        micr: string;
        neft: boolean;
        rtgs: boolean;
        state: string;
        swift: string | null;
        upi: boolean;
    }
  12. VariantDetail schema definition

    The VariantDetail schema provides comprehensive information about a product variant. It extends the base Variant schema and adds specific fields for product classification, shipping, SEO, and attributes.

    Key properties include:

    • product_type: The type of product, restricted to physical, digital, or bundle.
    • description: A text description of the variant (nullable).
    • category_ids: A read-only array of category identifiers.
    • tags: A read-only array of strings (nullable).
    • reviews_rating_sum and reviews_count: Metrics for product reviews.
    • hsn_code: Harmonized System Nomenclature code for taxation/shipping (nullable).
    • variant_options: A list of VariantOption objects.
    • product_attributes and variant_attributes: Lists of ProductAttribute objects.
    • shipping: A ProductShipping object containing shipping details.
    • seo: A Seo object for search engine optimization.
    • metadata: A nullable object with string-based additional properties.
    type VariantDetail = {components["schemas"]["Variant"]} & {
        product_type: "physical" | "digital" | "bundle";
        description: string | null;
        category_ids: string[];
        tags: string[] | null;
        reviews_rating_sum: number | null;
        reviews_count: number;
        hsn_code: string | null;
        variant_options: VariantOption[];
        product_attributes: ProductAttribute[];
        variant_attributes: ProductAttribute[];
        shipping: ProductShipping;
        seo: Seo;
        metadata: Record<string, string> | null;
    };