Skip to content

POS SDK Methods Reference

Complete reference for the Commerce Engine POS SDK (@commercengine/pos). This SDK provides specialized functionality for Point of Sale terminals, retail environments, and in-store transactions.

SDK Setup

Installation

bash
npm install @commercengine/pos

Basic Configuration

typescript
import { PosSDK, Environment } from "@commercengine/pos";

const pos = new PosSDK({
  storeId: "your-store-id",
  environment: Environment.Production, // or Environment.Staging
  apiKey: "your-api-key", // Required for authentication
});
typescript
import { PosSDK, MemoryTokenStorage, Environment } from "@commercengine/pos";

const pos = new PosSDK({
  storeId: "your-store-id",
  environment: Environment.Production,
  apiKey: "your-api-key",

  // Token storage for POS devices (usually memory-based)
  tokenStorage: new MemoryTokenStorage(),
  
  // Optional: Default headers for all requests
  defaultHeaders: {
    customer_group_id: "01JHS28V83KDWTRBXXJQRTEKA0", // For pricing and promotions
  },
  
  // Optional: Debug mode for development
  debug: true,
  logger: console.log,
  
  // Optional: Token lifecycle callbacks
  onTokensUpdated: (accessToken, refreshToken) => {
    console.log("POS device authenticated!");
  },
  onTokensCleared: () => {
    console.log("POS device logged out");
  },
});

POS-Specific Features

  • Device Authentication: Specialized login flow for POS terminals
  • Device Pairing: Connect terminals using pairing codes
  • Multi-Channel OTP: Support for email, SMS, and WhatsApp authentication
  • Unified Cart Management: Single API for all cart operations
  • Retail-Focused Catalog: Optimized for in-store product browsing
  • Offline-Ready: Designed for reliable terminal operations

Total POS SDK Methods: 60

POS SDK Methods

SDK Usage: pos.* (Single unified client)

Authentication

Methods: 7

SDK MethodHTTP MethodAPI Path
loginWithEmailPOST/pos/auth/login/email
loginWithPhonePOST/pos/auth/login/phone
loginWithWhatsappPOST/pos/auth/login/whatsapp
logoutPOST/pos/auth/logout
pairDevicePOST/pos/auth/pair-device
refreshAccessTokenPOST/pos/auth/refresh-token
verifyOtpPOST/pos/auth/verify-otp

Cart Management

Methods: 11

SDK MethodHTTP MethodAPI Path
createCartPOST/pos/carts
listCouponsGET/pos/carts/available-coupons
listPromotionsGET/pos/carts/available-promotions
getUserCartGET/pos/carts/users/{user_id}
getCartGET/pos/carts/{id}
deleteCartDELETE/pos/carts/{id}
createCartAddressPOST/pos/carts/{id}/address
evaluateCouponsGET/pos/carts/{id}/evaluate-coupons
evaluatePromotionsGET/pos/carts/{id}/evaluate-promotions
updateCartPOST/pos/carts/{id}/items
updateCartCustomerPOST/pos/carts/{id}/update-customer

Coupons & Promotions

Methods: 2

SDK MethodHTTP MethodAPI Path
applyCouponPOST/pos/carts/{id}/coupon
removeCouponDELETE/pos/carts/{id}/coupon

Credit & Loyalty

Methods: 4

SDK MethodHTTP MethodAPI Path
redeemCreditBalancePOST/pos/carts/{id}/credit-balance
removeCreditBalanceDELETE/pos/carts/{id}/credit-balance
redeemLoyaltyPointsPOST/pos/carts/{id}/loyalty-points
removeLoyaltyPointsDELETE/pos/carts/{id}/loyalty-points

Fulfillment

Methods: 1

SDK MethodHTTP MethodAPI Path
updateFulfillmentPreferencePOST/pos/carts/{id}/fulfillment-preference

Orders

Methods: 6

SDK MethodHTTP MethodAPI Path
getOrderDetailGET/pos/orders/{order_number}
listOrderActivityGET/pos/orders/{order_number}/activity
getOrderInvoiceGET/pos/orders/{order_number}/invoice
getPaymentStatusGET/pos/orders/{order_number}/payment-status
getOrderReceiptGET/pos/orders/{order_number}/receipt
getOrderShipmentsGET/pos/orders/{order_number}/shipments

Catalog

Methods: 14

SDK MethodHTTP MethodAPI Path
listCategoriesGET/pos/catalog/categories
listInventoriesGET/pos/catalog/inventories
listInventoryActivitiesGET/pos/catalog/inventories/activites
getInventoryDetailGET/pos/catalog/inventories/detail
listProductsGET/pos/catalog/products
listCrosssellProductsGET/pos/catalog/products/cross-sell
searchProductsPOST/pos/catalog/products/search
listSimilarProductsGET/pos/catalog/products/similar
listUpsellProductsGET/pos/catalog/products/up-sell
getProductDetailGET/pos/catalog/products/{product_id_or_slug}
listProductReviewsGET/pos/catalog/products/{product_id}/reviews
listProductVariantsGET/pos/catalog/products/{product_id}/variants
getVariantDetailGET/pos/catalog/products/{product_id}/variants/{variant_id}
listSkusGET/pos/catalog/skus

Other

Methods: 15

SDK MethodHTTP MethodAPI Path
getCustomersGET/pos/customers
getCustomerGET/pos/customers/{id}
listDevicesGET/pos/devices
claimDevicePOST/pos/devices/{id}/claim
unclaimDevicePOST/pos/devices/{id}/unclaim
getFulfillmentOptionsPOST/pos/fulfillment-options
listLocationsGET/pos/locations
listPaymentOptionsGET/pos/payments/payment-options
listShipmentsGET/pos/shipping/shipments
checkInventoryGET/pos/shipping/shipments/{order_number}/check-inventory
refundShortfallPOST/pos/shipping/shipments/{order_number}/refund-shortfall
getShipmentGET/pos/shipping/shipments/{reference_number}
getShipmentInvoiceGET/pos/shipping/shipments/{reference_number}/invoice
updateShipmentPUT/pos/shipping/shipments/{reference_number}/manual-update
getUserGET/pos/users/{id}

Auto-generated from SDK source code and OpenAPI specifications

Last updated: