RideKit
Docs/Reference/ONDC: rides from India's open network

ONDC: rides from India's open network

Built: 2026-11-02. For the operator in India, and for whoever maintains the code.

On the Open Network for Digital Commerce (ONDC), a rider can book a ride from a buyer app (BAP) without installing your app. Buyer apps include Paytm, Google Maps, and state apps such as Yatri Sathi and Kerala Savaari. This platform is a seller (BPP) in ONDC's mobility domain (ONDC:TRV10, ride hailing):

  • it offers your ride types at your prices;
  • your drivers do the trip;
  • the buyer app is told about every step.

Nothing changes for your drivers: an ONDC ride reaches them as an ordinary offer.

How a ride goes

Each request from the network is a signed POST. We answer at once with an ACK (or a NACK with the reason), then send the real answer as a signed POST to the buyer app's on_<action>.

Buyer app sends We answer What happens here
search (from and to) on_search Every active ride type allowed at the pickup, priced as in your app
select (a ride type) on_select The quote and its parts: base, distance, surge, tolls, minimum-fare adjustment
init (the rider's name and phone) on_init Payment terms: the driver collects at the end, in cash or UPI
confirm on_confirm The ride is booked and dispatched. A repeated confirm returns the same order.
status, track on_status, on_track Where the ride is, and the driver's position while the ride is live
cancel on_cancel Cancelled under your normal cancellation-fee rules, with the fee
rating on_rating Recorded as the rider's rating of the driver
support on_support Your support phone and email (Settings → Branding)

Updates the buyer app didn't ask for. Every change of the ride goes to the buyer app as on_status, checked every 10 seconds:

Ride state Sent to the buyer app
Driver assigned Name, phone, car, plate and start OTP
Driver arrived —
Trip started —
Trip ended The metered fare, marked paid
Cancelled Who cancelled. "No driver found" also counts as cancelled.

If a send fails, it is retried on the next check.

Start OTP. It is the ride PIN (rides/ride-pin.ts). The rider reads it from the buyer app and the driver types it in to start the trip.

The rider. The rider is found by phone number, or created as an ordinary rider. The trip appears in their history if they later sign in to your app.

Payment. Only payment collected by the driver at the end is offered (collected_by: BPP, ON-FULFILLMENT). A buyer app that wants to collect up front (collected_by: BAP) is refused with code 30010. Collecting through the buyer app would need ONDC settlement (RSF), which is not built.

Joining ONDC (Admin → Open network)

  1. Register. Sign up as a network participant with ONDC and get a subscriber ID (your domain) from their onboarding.

  2. Make keys. On the Open network page, press Make keys. The private halves are stored with the other credentials; the page shows the two public keys to give ONDC.

  3. Fill in Admin → Providers → ONDC:

    • subscriber ID;
    • unique key ID;
    • environment (staging, then preprod, then production);
    • ONDC's encryption public key for that environment (from ONDC's guide);
    • the subscribe request ID.

    The subscriber URL defaults to this API + /ondc. If you change it, your reverse proxy must forward /ondc/* to the API.

  4. Prove your domain. Serve the site-verification page (/api/ondc/ondc-site-verification.html) at https://<subscriber id>/ondc-site-verification.html. The registry calls /ondc/on_subscribe, and this platform answers its challenge.

  5. Switch on. After ONDC approves you, set Take rides from the network to true. Until then every request gets a NACK ("Provider not found").

  6. Test. Run ONDC's log validation utility on staging before going live.

The page shows four counts:

  • searches, rides booked and rides completed in the last 30 days;
  • failed messages in the last 24 hours.

Every transaction lists the ride and each signed message both ways, with the full JSON. Messages are kept for 180 days.

Replacing keys. Replace keys breaks the registry entry until the new public keys are registered. Buyer apps refuse your messages in the meantime.

Checks on every request

  • The context must be ONDC:TRV10, name the action, and give a bap_uri over https.
  • The Authorization header must be signed by the bap_id. The key is looked up in the registry and cached for an hour.
  • The digest covers the exact bytes received. A changed body, an expired signature or an unknown key gets a 401 NACK.

For developers

Piece Where
Signing, digest, keys, challenge backend/src/ondc/beckn-auth.ts. Ed25519 with a BLAKE2b-512 digest, X25519 for encryption, AES-256-ECB for the subscribe challenge; all from Node's built-in crypto.
TRV10 shapes backend/src/ondc/trv10.ts: catalog, quote, order, states, money, phone
Flow backend/src/ondc/ondc.service.ts. receive checks, ACKs and processes. pushChanges runs every 10 seconds; pruneMessages runs daily.
Routes POST /ondc/:action (public, signed), POST /ondc/on_subscribe, GET /ondc/ondc-site-verification.html, /admin/ondc/*
Tables Migration 120: ondc_orders (one per buyer app transaction) and ondc_messages
Admin admin/src/app/(dashboard)/ondc/page.tsx. Credentials are under Providers → ondc.
Tests ondc/beckn-auth.spec.ts, which includes the BLAKE2b-512 test vector, and ondc/trv10.spec.ts

How it was tested end to end. A mock registry and buyer app on :3995 (scratchpad/ondc-mock.mjs) signed real requests (ondc-send.mjs), and a driver on the Android emulator did the trip. The run covered:

  • search, select, init, confirm and a retried confirm;
  • assigned, arrived (PIN), started and ended, each pushed;
  • status, track, support and rating;
  • cancellation by the rider and by the driver;
  • an unsigned request, a tampered body, and up-front payment, all refused.

Before going live, confirm:

  • the exact field set expected by the TRV10 version your buyer apps run (2.0.1 is assumed here);
  • ONDC's current registry lookup API and environment URLs;
  • that ONDC's log validation utility passes on staging;
  • network participant agreements and settlement terms with ONDC.

These change between spec versions, and ONDC's onboarding team has the current ones.

source: docs/ondc.md (ships identically in the product zip)