ONDC Network Integration

ONDC Vaatun

A Next.js service for integrating with the Open Network for Digital Commerce. Handle subscription verification, domain ownership, and cryptographic operations with ease.

Built by Vaatun

What is ONDC?

The Open Network for Digital Commerce (ONDC) is a Government of India initiative to democratize e-commerce by creating an open, interoperable network. It enables buyers and sellers to transact regardless of the platform they use, breaking down digital commerce silos.

Features

Subscription Verification
Handle ONDC challenge-response verification using AES-256-ECB encryption
Domain Verification
Serve signed verification pages to prove domain ownership with Ed25519 signatures
Secure Key Management
Environment-based configuration for X25519 and Ed25519 private keys
Health Monitoring
Built-in health check endpoints for monitoring service availability
TypeScript
Full type safety throughout the application with modern Next.js 16
High Performance
Pre-computed Diffie-Hellman shared secrets for fast cryptographic operations

API Endpoints

POST/api/ondc/on_subscribe
ONDC Subscription Endpoint
Handles ONDC subscription challenge-response verification

How it works:

  1. ONDC sends an encrypted challenge using AES-256-ECB
  2. The endpoint decrypts it using the Diffie-Hellman shared secret
  3. Returns the decrypted answer to verify successful subscription

Request Body:

{
  "subscriber_id": "ondc-staging.vaatun.com",
  "challenge": "encrypted_challenge_string"
}

Response:

{
  "answer": "decrypted_challenge_string"
}
GET/ondc-site-verification.html
Site Verification
Serves HTML page with signed meta tag for domain verification

Response:

<html>
  <head>
    <meta name="ondc-site-verification"
          content="SIGNED_REQUEST_ID" />
  </head>
  <body>ONDC Site Verification Page</body>
</html>
GET/api/ondc/health
Health Check
Monitor service availability and status

Response:

{
  "status": "Health OK!!"
}
made withNext.js 16