Skip to main content

Use Cases

Explore common scenarios supported by the Stream Blueprint:

Video Platforms

Bill customers based on video bandwidth consumption and streaming quality.

Music Streaming

Track audio streaming usage per user for subscription tiers.

Live Events

Monitor live stream consumption and charge for bandwidth usage.

Real-Time Data

Track real-time data transfer for IoT and telemetry applications.
Perfect for video/audio streaming platforms, live streaming services, and real-time data applications.

Quick Start

Track streaming bytes consumed by your customers:
1

Install the SDK

npm install @dodopayments/ingestion-blueprints
2

Get Your API Keys

3

Create a Meter

Create a meter in your Dodo Payments Dashboard:
  • Event Name: stream_consumption (or your preferred name)
  • Aggregation Type: sum to track total bytes streamed
  • Over Property: bytes to bill based on bandwidth usage
4

Track Stream Usage

import { Ingestion, trackStreamBytes } from '@dodopayments/ingestion-blueprints';

const ingestion = new Ingestion({
  apiKey: process.env.DODO_PAYMENTS_API_KEY,
  environment: 'test_mode',
  eventName: 'stream_consumption'
});

// Track video stream consumption
await trackStreamBytes(ingestion, {
  customerId: 'customer_123',
  bytes: 10485760, // 10MB
  metadata: {
    stream_type: 'video',
  }
});

Configuration

Ingestion Configuration

apiKey
string
required
Your Dodo Payments API key from the dashboard.
environment
string
required
Environment mode: test_mode or live_mode.
eventName
string
required
Event name that matches your meter configuration.

Track Stream Bytes Options

customerId
string
required
The customer ID for billing attribution.
bytes
number
Number of bytes consumed in the stream. Required for bandwidth-based billing.
metadata
object
Optional metadata about the stream like stream type, quality, sessionId, etc.

Best Practices

Track by Chunk: For long streams, track consumption in chunks rather than waiting for the entire stream to complete.
Accurate Byte Counting: Ensure byte counts include all overhead (headers, protocol overhead) if billing for total bandwidth.
I