Boni
Back to blog

Boni

A Developer's Guide to Adding B2B Ordering to Your App with the Boni Trade API (ONDC eB2B)

Boni Team8 min read

A Developer's Guide to Adding B2B Ordering to Your App with the Boni Trade API (ONDC eB2B)

If you've ever looked at the ONDC protocol specification and thought "this is a lot of yak-shaving before I can place a single order," you're not wrong. ONDC eB2B (the network's business-to-business commerce domain) is powerful — but integrating it from scratch means implementing Beckn protocol handshakes, managing async callback flows, running your own signing/verification infrastructure, registering as a network participant, and building a full order lifecycle engine. Most product teams don't want to build any of that; they want to use B2B ordering as a feature.

That's the gap the Boni Trade API is designed to close.

This article walks through what the API abstracts, what a typical integration looks like conceptually, and who it's actually useful for. Note upfront: Boni Trade API is a product built by the Boni team. Any endpoint shapes or request/response examples in this article are illustrative only — they show the intended shape and developer experience, not a verbatim current spec. Always refer to the official documentation and contact the team for current credentials and the live API contract.


The Real Cost of Rolling Your Own ONDC eB2B Integration

Before getting into what the Boni Trade API does, it's worth being concrete about what you're skipping if you use it.

A bare-metal ONDC eB2B integration requires you to:

1. Become a network participant. You register on the ONDC registry, get issued keys, and maintain your subscriber entry. This is a real operational step — not a five-minute sign-up.

2. Implement Beckn protocol async flows. ONDC is not simple REST request/response. Every action (search, select, init, confirm) triggers an async callback (on_search, on_select, on_init, on_confirm) from the seller-side platform back to your registered callback URL. You need to manage correlation, timeouts, and partial/aggregated responses from multiple sellers simultaneously.

3. Handle signing and verification. Every ONDC request requires a signed Authorization header. Every inbound callback needs verification against the sender's public key, fetched from the ONDC registry at call-time. If you get this wrong, your requests get rejected by network gateways.

4. Build the order lifecycle state machine. A B2B order moves through quote, confirmation, fulfillment updates, and cancellation flows — often with multiple parties involved, differing seller capabilities, and no guaranteed schema consistency across seller platforms.

5. Keep up with protocol versions. ONDC eB2B evolves. Keeping pace with spec changes, new required fields, and seller-platform quirks is ongoing work.

For a team whose core product is a procurement tool, an ERP, or a marketplace — none of this is your value-add. You want ordering as a capability, not a protocol adapter as a codebase.


What the Boni Trade API Abstracts

The Boni Trade API is a REST-over-ONDC layer. It handles the Beckn protocol machinery on your behalf and exposes a conventional HTTP API with synchronous (or near-synchronous) semantics for most operations.

Concretely, the abstraction layer covers:

  • Network registration and key management — you don't need your own registry subscriber entry to make calls; Boni operates the network-participant infrastructure.
  • Signing and verification — every outbound ONDC request is signed on your behalf; inbound callbacks are verified before they surface to your integration.
  • Async-to-sync bridging — the raw ONDC flow is fire-and-wait-for-callback. The Trade API converts this into a response you can poll or receive via webhook, depending on the operation.
  • Catalogue aggregationon_search responses from multiple seller platforms on the ONDC network are aggregated and normalized before being returned to your API call.
  • Order state management — the API maintains order state across the confirm → status → update → cancel lifecycle, so you don't need to build your own ONDC order store.

The result: your application speaks ordinary HTTP to the Boni Trade API, and the API speaks ONDC on the network.


Conceptual Integration Walkthrough

Reminder: The endpoint paths, field names, and response structures below are illustrative examples to show the shape of the integration. They are not guaranteed to match the current live API. Contact the team for the actual spec.

Step 1 — Search the catalogue

A B2B order starts with discovery. You pass a category, location, and optional keyword; the API fans out a search to relevant sellers on the ONDC network and returns normalized results.

POST /v1/trade/search
Authorization: Bearer <your_api_token>

{
  "category": "grocery-wholesale",
  "location": { "city_code": "std:080", "pincode": "560001" },
  "query": "basmati rice 25kg"
}

The response aggregates catalogue items from matching sellers on the network — item names, base prices, minimum order quantities, and seller identifiers — without you ever touching a raw search payload or managing an on_search callback endpoint.

Step 2 — Select items and get a quote

Once you've identified items, you select them to get a firm quote, including any applicable B2B pricing tiers, taxes, and fulfillment options the seller supports.

POST /v1/trade/select
Authorization: Bearer <your_api_token>

{
  "session_id": "srch_abc123",
  "items": [ { "item_id": "item_xyz", "provider_id": "seller_001", "quantity": 5 } ],
  "fulfillment_type": "delivery"
}

The quote response includes a breakup (unit price, applicable GST, delivery charges) scoped to the seller's terms. At this stage, nothing is committed — you're getting a binding quote to show your user before they confirm.

Step 3 — Initialize and confirm the order

Init collects fulfillment details and gets the final order terms from the seller. Confirm commits the order.

POST /v1/trade/init
Authorization: Bearer <your_api_token>

{
  "quote_id": "qte_def456",
  "billing": { "name": "Example Procurement Pvt Ltd", "gstin": "29XXXXX" },
  "delivery_address": { "...": "..." }
}
POST /v1/trade/confirm
Authorization: Bearer <your_api_token>

{
  "order_draft_id": "ord_draft_789",
  "payment": { "type": "ON-ORDER", "reference": "txn_001" }
}

On success, you receive an order_id that maps to a confirmed ONDC order on the seller's platform.

Step 4 — Track order status and handle updates

After confirmation, order status flows in from the seller via ONDC status callbacks. The API surfaces these via a polling endpoint or a webhook you register.

GET /v1/trade/orders/{order_id}/status
Authorization: Bearer <your_api_token>

Returns the current fulfillment state (e.g. ACCEPTED, IN_TRANSIT, DELIVERED, CANCELLED) along with any seller-provided tracking info. For cancellations or return/replacement requests, there are corresponding endpoints that translate into the appropriate ONDC cancel and update flows on the network.


Who This Is Actually For

The Boni Trade API is most useful if you're building in one of these categories:

B2B marketplaces and procurement platforms. Embedding ONDC-network ordering lets your users source from a broader seller base without you recruiting sellers directly. The network handles seller participation.

ERP and retail-tech integrations. Purchase order workflows that currently terminate at a catalogue can extend to live ordering and status tracking. A reorder trigger in your inventory system can place an actual ONDC order through the API.

Fintech with embedded commerce. Invoice financing, trade credit, and supply-chain finance products often sit right next to the purchasing flow. If you're underwriting B2B transactions anyway, having ordering in your product loop (rather than linking out) is a meaningful UX and data advantage.

Vertical SaaS for distribution. Distributor management tools, wholesale ordering apps, or category-specific sourcing tools (pharma, FMCG, agri) where you need structured B2B ordering rather than a WhatsApp thread.


Current Maturity — An Honest Note

ONDC eB2B is a live but evolving network. Seller density varies significantly by category and geography today, and the protocol itself continues to be updated. The Boni Trade API is in active development — certain lifecycle flows (e.g. complex return flows, multi-seller consolidated orders) may have capability caveats in the current version.

If you're evaluating this for a production integration, the right next step is to talk to the team directly, understand the current feature envelope, and get access to a sandbox environment before committing to the shape of your integration. Don't build against illustrative examples — build against the actual spec.


Getting Access

The Boni Trade API is available to developers through Boni's API hub. To get started:

  1. Visit boni.one/api-hub and reach out via the developer / API access contact.
  2. Ask about sandbox credentials for the eB2B trade API — you'll want a test environment that lets you run the search → select → confirm flow against test sellers before going to the live ONDC network.
  3. Review the current API documentation (shared on access) for exact endpoint contracts, authentication flow, and webhook setup.

The ONDC network is genuinely useful infrastructure for B2B commerce in India. The Boni Trade API is one way to access it without building a protocol adapter from scratch. If your product already has the business users and the ordering workflow, the API is worth evaluating as the network layer.


This article describes the Boni Trade API as of mid-2026; always verify current capabilities and spec with the team via boni.one before building.

BoniTrade APIONDCDevelopers

Next step

Bring Boni into your business.

Talk to Boni