Use Cases

ONDC and SMS Verification: How Sellers and Logistics Providers Should Handle OTP (2026)

Optimize your ondc sms verification india flows. Learn ONDC buyer-seller registration nodes, logistics drop-off OTP rules, and Node.js API code patterns.

StartMessaging Team Updated

The Open Network for Digital Commerce (ONDC) is transforming digital retail in India. By establishing an open protocol network, ONDC allows independent buyer apps (like Paytm or Pincode) to display products from separate seller apps (like Mystore or SellerApp) and execute deliveries through independent logistics providers (like Dunzo, Shadowfax, or Shiprocket).

Unlike closed platforms (such as Amazon or Flipkart) where a single corporation manages the entire transaction lifecycle, ONDC operates as a decentralized network. This decentralized architecture introduces new communication touchpoints between sellers, buyers, and logistics networks. Implementing a robust ondc sms verification india flow is essential for verifying seller identities, validating buyer logins, and securing physical drop-offs. This guide maps out the ONDC verification structure and demonstrates how to integrate SMS checkpoints into your network nodes.

ONDC Architecture and the Decentralized SMS Touchpoints

In ONDC, transactions flow across multiple separate software applications connected via the Beckman Protocol. This open network structure creates three distinct verification loops:

1. Seller Network Participant (NP) Onboarding

When a local merchant registers on an ONDC seller app, the platform must verify the merchant’s business details, bank credentials, and mobile number. Because these sellers publish catalogs directly to the open network, verifying mobile identities via SMS OTP is the primary check to prevent fraudulent catalog publishing.

2. Buyer App Logins

When a consumer opens an ONDC-enabled buyer interface, their account login is authenticated by the buyer app. This requires a standard, low-latency OTP flow to ensure users can log in and view local inventory within seconds.

3. Logistics Handshake and Delivery OTP

This is the most critical checkpoint. When an order is placed, a logistics partner collects the package from the seller and delivers it to the buyer. To verify that delivery occurred, the driver must input a delivery OTP code generated by the seller app and sent to the buyer’s handset. The driver cannot mark the job as completed in their logistics app without this verification code.

The Logistics Handshake: Who Triggers the Delivery OTP?

In a closed e-commerce platform, the same database tracks the driver’s GPS location, the package status, and the customer’s phone number. On ONDC, these components reside on different servers.

When a package reaches the customer’s address, the logistics driver requests the delivery verification code. The ONDC protocol specifies the responsibility loop:

First, the Buyer App sends the buyer’s contact number to the ONDC gateway during order creation.

Second, the Seller App receives the order details, processes the dispatch, and acts as the creator of the delivery OTP. Before delivery occurs, the seller app generates a verification code and sends it to the buyer’s phone via an SMS gateway.

Third, when the driver arrives, the customer reads the code. The driver’s logistics app forwards the code back through ONDC rails to the seller app. The seller app validates the code and responds with a success status, completing the delivery chain.

Node.js Implementation: Seller Node Delivery Handshake

We will write a Node.js server script that seller applications can use to generate and dispatch delivery handshake codes using the StartMessaging API.

// ondc-delivery-verification.js

const SMS_KEY = process.env.STARTMESSAGING_KEY || 'sm_live_your_key_here';
const DISPATCH_ENDPOINT = 'https://api.startmessaging.com/otp/send';

// Database mock to track pending ONDC delivery handshakes
const deliveryLedger = new Map();

export async function triggerDeliveryHandshake(orderId, buyerPhone, sellerName) {
  console.log(`[ONDC Delivery] Generating verification for Order: ${orderId}`);

  // Generate a secure 6-digit delivery handshake code
  const handshakeCode = Math.floor(100000 + Math.random() * 900000).toString();

  // DLT-approved variables structure
  const variables = {
    otp: handshakeCode,
    appName: `${sellerName} Order ${orderId}`
  };

  try {
    const response = await fetch(DISPATCH_ENDPOINT, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': SMS_KEY
      },
      body: JSON.stringify({
        phoneNumber: buyerPhone,
        variables: variables
      })
    });

    const result = await response.json();

    if (!response.ok) {
      return { success: false, error: result.message || 'SMS route failed' };
    }

    // Save the code to validate later when the driver submits it
    deliveryLedger.set(orderId, {
      code: handshakeCode,
      messageId: result.data.messageId,
      expiresAt: Date.now() + 10 * 60 * 1000 // Valid for 10 minutes
    });

    return {
      success: true,
      messageId: result.data.messageId
    };
  } catch (error) {
    console.error('Failed to trigger delivery OTP:', error.message);
    return { success: false, error: error.message };
  }
}

export async function validateDeliveryCode(orderId, submittedCode) {
  const record = deliveryLedger.get(orderId);
  
  if (!record) {
    return { verified: false, reason: 'No pending delivery found for this order' };
  }

  if (Date.now() > record.expiresAt) {
    deliveryLedger.delete(orderId);
    return { verified: false, reason: 'Delivery code expired' };
  }

  if (record.code !== submittedCode) {
    return { verified: false, reason: 'Incorrect verification code' };
  }

  // Delivery confirmed, remove record from active cache
  deliveryLedger.delete(orderId);
  return { verified: true };
}

The script manages ONDC delivery states. When the package is out for delivery, the backend generates a code, calls StartMessaging, and saves the session. When the driver’s logistics app sends the customer’s input back to the seller node, the validate helper confirms the handshake.

Handling Decentralized Delivery Latency

A common failure mode in decentralized digital networks is delivery notification latency. If the logistics driver stands at the buyer’s doorstep and the buyer does not receive the delivery OTP within 30 seconds, the delivery process stalls, increasing operational costs for logistics providers.

Because ONDC integrates multiple software layers, minimizing API latency is essential. You must choose an SMS gateway that connects directly to Indian telecom operators to ensure sub-5 second delivery times.

StartMessaging provides direct carrier routing to ensure delivery rates remain in the 97–99% range. With transactional messages billed at a flat rate of exactly ₹0.25/OTP and a minimum wallet top-up of ₹1,000, ONDC participants can scale from a few orders a day to thousands without monthly commitments.

Frequently Asked Questions

Q: Is OTP verification mandatory for all ONDC transactions?

A: For order execution and logins, the choice of verification channels resides with the individual buyer and seller apps. However, for logistics handshakes, ONDC delivery specifications require the driver to input an OTP code generated by the seller node to confirm physical package collection and drop-off.

Q: Does ONDC have its own central SMS gateway for participants?

A: No. ONDC is a decentralized network protocol, not a centralized platform. Every participant (buyer app, seller app, logistics provider) is responsible for provisioning their own SMS gateways, API keys, and handling DLT regulations independently.

Q: What happens if a buyer does not receive the ONDC delivery OTP?

A: If the SMS fails to deliver, ONDC logistics protocols allow the seller node to re-trigger the OTP API call. The driver’s logistics app displays a “Resend OTP” option, which calls the seller’s webhook to dispatch a new verification code.

Q: Can ONDC seller apps send order updates via WhatsApp?

A: Yes. Many ONDC seller nodes send duplicate order confirmations and tracking links via WhatsApp to improve visibility. However, because logistics drivers rely on SMS for offline reliability, the core delivery handshake OTP is routed through standard carrier networks.

Ready to integrate your ONDC participant node? Register for a developer account at StartMessaging and begin dispatching transactions instantly.

S

StartMessaging Team

StartMessaging Team

Related posts