Docs

Copy-paste your way into ONDC

LanceIQ is the ONDC pipe: send a clean API request, let LanceIQ handle Beckn signing and callback chaos, then read back one usable result.

1. Install

npm install @lanceiq/ondc

2. Search ONDC Like A Normal API

`timeout` is the bounded wait window. LanceIQ collects `on_search` callbacks during that time and returns one clean search session.

import { createLance } from '@lanceiq/ondc';

const lance = createLance({
  baseUrl: 'https://api.lanceiq.com',
  workspaceId: 'your-workspace-id',
});

const session = await lance.search({
  query: 'paracetamol',
  city: 'std:080',
  timeout: 5000,
});

console.log(session.results);

3. Verify Inbound Callbacks

const result = await lance.handleCallback({
  body: rawBody,
  headers: {
    authorization: req.headers.authorization ?? '',
    digest: req.headers.digest ?? '',
    'content-type': 'application/json',
  },
});

4. Run Shadow Mode For The First 100 Orders

Import partner order truth, let LanceIQ classify drift and ghost orders, then resolve triage items once ops confirms the fix.

await lance.importShadowOrders({
  source: 'partner_ops_csv',
  orders: [
    {
      orderId: 'ord_123',
      transactionId: 'tx_123',
      partnerStatus: 'cancelled',
    },
  ],
});

await lance.updateShadowResolution('ord_123', {
  resolutionStatus: 'resolved',
  resolutionNote: 'Seller app caught up with ONDC state.',
  resolvedBy: 'pilot-operator',
});

5. Probe Staging

Once your staging subscriber credentials are in `.env.local`, use these commands to validate registry resolution and fire one signed staging search.

npm run ondc:staging:check
npm run ondc:staging:search