Written by the Titli Video SDK team. I work on Titli Video SDK, a video and audio calling SDK and API. This post is based on the guides we publish on our site; the API calls come from our reference. Corrections are welcome in the comments.

Paid consultations are a common shape for Indian apps: a user tops up a wallet by UPI, picks an astrologer, a doctor or an adviser, and pays per minute or per session. The calling part is the easy bit. The hard parts are making sure a call never runs past what the user paid for, and charging the right amount when the network drops halfway.

This post gets a first call running with no backend, works out the costs in rupees, then adds the server that a paid app should have before launch, and lists what changes for a telehealth app.

Three prices, two balances

Name the money before writing code.

Price Who sets it Who pays whom Where it lives
The consultant's price per minute You (or the consultant, within your limits) User pays your app Your database
The consultant's share You Your app pays the consultant Your database
Call minutes: ₹0.20 video, ₹0.05 audio per participant-minute Titli's price list Your app pays Titli from a prepaid balance Your Titli account

The first two are entirely yours. Titli does not collect payments from your users, does not hold their money and does not pay consultants. It meters the call on its media servers and debits your prepaid balance per second, only while at least two people are connected.

The arithmetic for a 12-minute consult

Say you charge users ₹30 a minute for video and ₹15 for audio (your numbers will differ).

Video Audio
Length 12 minutes 12 minutes
User pays you 12 × ₹30 = ₹360 12 × ₹15 = ₹180
Participant-minutes (1:1 call) 2 × 12 = 24 2 × 12 = 24
Titli bills you, INR account 24 × ₹0.20 = ₹4.80 24 × ₹0.05 = ₹1.20
Titli bills you, USD account 24 × $0.0023 = $0.0552 24 × $0.00057 = $0.01368
Left for the consultant and you ₹355.20 ₹178.80

Payment gateway fees and taxes on your own sales are separate. Your Titli balance is recharged in the console by UPI or bank transfer (smallest recharge ₹500); there is no setup or monthly fee, and a new account gets a one-time welcome credit of ₹100 (or $1.20 on a USD account), once per person or company. Current prices: pricing page.

Start with just the App Key (no backend)

Build and test the calling part first, without a server:

  1. Get your App Key in the console under Projects → Quick mode, and add your app's package name, bundle ID or website.
  2. Install the SDK: Flutter, Android, iOS, React Native or web from public registries at 0.2.0: pub.dev, npm, JitPack or Swift Package Manager.
  3. Init with the App Key and start a call from the consultant's profile:
import 'package:titli_video_sdk/titli_video_sdk.dart'; await TitliVideo.init(appKey: 'tak_…', userId: 'user_1001', userName: 'Ravi'); final call = await TitliVideo.startCall(type: TitliCallType.video); // Send call.callId to the consultant (your push or chat); their app calls TitliVideo.joinCall(callId). 

That is a real, metered consult with no backend. Quick-mode caps you set in the console (the longest call, each user's daily minutes, a daily spend cap) keep a copied App Key from running up your bill.

Before you take money: let your server decide who may call

Calls work without a server, but an app that charges its own users per minute is better off with a server deciding who may call. The wallet check, the call's time limit and the settlement must not depend on what a phone says. This is the production hardening path, and it is the one to ship with a paid app.

  1. App: the user taps Call on a consultant. The app asks your server, which holds the project key (key ID and secret). That key never goes into the app.
  2. Your server: reads the wallet and the consultant's price from your database.
  3. Your server → Titli: GET /v1/end-users/{end_user_id}, a read-only pre-call check.
  4. Your server → Titli: POST /v1/calls with max_duration_seconds worked out from the wallet, then POST /v1/calls/{call_id}/tokens once for the user and once for the consultant.
  5. Both apps: join with their own tokens. Billing starts when the second person connects.
  6. The call ends: someone hangs up, the cap is reached, or your server calls POST /v1/calls/{call_id}/end.
  7. Titli → your server: the call.ended webhook carries a signed receipt. You debit the user and credit the consultant from its connected seconds.

Step 1: Check the wallet and compute the cap

With a wallet of ₹200 and a price of ₹30 a minute, the user can afford 200 × 60 ÷ 30 = 400 seconds (6 minutes 40 seconds). That goes into max_duration_seconds (10 to 86400), and Titli's server ends the call when that much connected time has passed. Nothing can overrun, even if your server is down at that moment.

// consult-start.js (Node 22+). Runs on YOUR server when a user taps "Call". const API = 'https://api-videosdk.titliapp.com'; const AUTH = 'Basic ' + Buffer.from(`${process.env.TITLI_KEY_ID}:${process.env.TITLI_KEY_SECRET}`).toString('base64'); export async function titli(method, path, body) { const r = await fetch(API + path, { method, headers: { Authorization: AUTH, 'Content-Type': 'application/json' }, body: body && JSON.stringify(body) }); const j = await r.json(); if (!r.ok) throw Object.assign(new Error(j.error?.code || String(r.status)), { status: r.status }); return j; } // `db` and `notifyConsultant` are your own code. export async function startConsult(user, consultant, type) { // type: 'video' | 'audio' // 1. YOUR wallet and YOUR price, in paise (integers), never floats. const pricePaise = type === 'video' ? consultant.videoPricePaise : consultant.audioPricePaise; const walletPaise = await db.walletBalance(user.id); // 2. Titli pre-call check: free seconds left for this user, and can a call start on your account? const eu = await titli('GET', `/v1/end-users/${encodeURIComponent(user.id)}`); if (!eu.can_start_call) throw new Error('calls_unavailable'); // your Titli balance is empty: alert your team // 3. Seconds the wallet pays for, plus any free seconds you give, capped by your own ceiling. const paidSeconds = Math.floor((walletPaise * 60) / pricePaise); const maxSeconds = Math.min(paidSeconds + eu.free_seconds_available, 3600); if (maxSeconds < 60) throw new Error('recharge_needed'); // 4. Create the call with the cap, remember the price, mint one token per person. const call = await titli('POST', '/v1/calls', { type, payer_end_user_id: user.id, max_duration_seconds: maxSeconds }); await db.consults.insert({ callId: call.id, userId: user.id, consultantId: consultant.id, pricePaise, maxSeconds }); const mine = await titli('POST', `/v1/calls/${call.id}/tokens`, { end_user_id: user.id, role: 'user', name: user.displayName }); const theirs = await titli('POST', `/v1/calls/${call.id}/tokens`, { end_user_id: consultant.id, role: 'host', name: consultant.displayName }); await notifyConsultant(consultant.id, { callId: call.id, url: theirs.livekit_url, token: theirs.token }); return { callId: call.id, url: mine.livekit_url, token: mine.token, maxSeconds }; } 

can_start_call is about your Titli balance and the user's free seconds. It knows nothing about the user's wallet in your app. If it is false, the fix is on your side.

Use a stable, pseudonymous end_user_id (letters, digits and _ . : @ -, up to 128 characters), never a phone number.

Step 2: Warn the user before the money runs out

Your server returned maxSeconds with the token, so the app can count down without asking anyone. In Flutter, TitliCall.duration is the time since the other person joined:

import 'package:titli_video_sdk/titli_video_sdk.dart'; // token, livekitUrl and maxSeconds came from YOUR backend (startConsult above). final call = await TitliCall.connect(url: livekitUrl, token: token, video: true); var warned = false; call.duration.addListener(() { // Display only: the bill and the cut-off both come from the server. final left = maxSeconds - call.duration.value.inSeconds; if (left <= 60 && !warned) { warned = true; showLowBalanceBanner(secondsLeft: left); // your own widget } }); 

The Flutter package is on pub.dev (flutter pub add titli_video_sdk). A complete call screen is in the Flutter sample; a browser version is in the web sample.

Step 3: End from the server when it matters

await titli('POST', `/v1/calls/${callId}/end`); // everyone; safe to call twice await titli('POST', `/v1/calls/${callId}/participants/${userId}/remove`); // one person 

The ended call's end_reason tells you what happened: max_duration when the cap was reached, ended_by_vendor when your server ended it, completed when both people left. If everyone drops, the call stays open for 30 seconds, so a quick reconnect continues the same consult, and nothing is billed while fewer than two people are connected.

Step 4: Settle from the signed receipt

No money moves in your ledger until the server-side record arrives. The call.ended webhook brings the call, its receipt and an Ed25519 signature over the receipt's canonical JSON.

// After verifying the Titli-Signature header on the raw body (see the webhooks reference): if (event.event === 'call.ended') { const { receipt, receipt_signature } = event.data; if (!(await receiptIsValid(receipt, receipt_signature))) return; // Ed25519, public key from GET /v1/receipts/public-key const c = await db.consults.find(receipt.call_id); const seconds = Math.max(0, receipt.connected_seconds - receipt.free_seconds); const chargePaise = Math.ceil((seconds * c.pricePaise) / 60); // your rule: per second, rounded up to the paisa await db.settleConsult(c, { chargePaise, seconds, receipt, idemKey: `consult:${c.callId}:charge` }); } 

Store the receipt with the consult. When a user disputes a charge, it shows the connected seconds, and the signature shows nobody edited it. The signature check and an Express webhook receiver are in the Node.js token server sample; the ledger design (holds, idempotency keys, rounding, refunds) is in our guide on user wallets for per-minute billing.

What changes for a telehealth app

The same flow works for doctor consultations, with a few differences.

One private call per appointment. Create the call when the appointment opens, set max_duration_seconds to the slot length plus a short grace period, and mint each token only when that person taps Join, with a short ttl_seconds (from 30 seconds up).

Pseudonymous ids, and no health data in the call. Send an opaque id such as pt_7f3a91 as end_user_id, never a phone number or a health record number. Keep diagnoses out of display names and metadata.

Per consultation or per minute. Many clinics charge a flat fee per consult; the cap and the receipt still matter, because they tell you the consult happened and for how long.

What the video layer does not do, stated plainly:

  • Titli does not record calls. Audio and video are not stored. If your policy requires a recording, you cannot get it from this API.
  • Titli holds no HIPAA, SOC 2 or ISO 27001 certification today, and publishes no uptime SLA. Media servers are in India.
  • Under India's Digital Personal Data Protection Act, 2023, your app is the data fiduciary and the video vendor is your processor. Collect and store consent in your own flow. Telemedicine has its own practice rules for doctors. Check what applies to you with your own legal and clinical advisers; this post is not legal or medical advice.

Cost. At the list price a 15-minute 1:1 video consult is 30 participant-minutes: ₹6.00, or $0.069 on a USD account. The smallest recharge of ₹500 covers 83 such consults. An audio follow-up of the same length is ₹1.50.

Checklist

  • [ ] Calls tested end to end with the App Key alone.
  • [ ] Before launch: the project key (key ID and secret) is only on your server, and paid calls are created there.
  • [ ] Each call is created with max_duration_seconds from the wallet or the slot.
  • [ ] The app shows a countdown, but the server is the meter.
  • [ ] The user is charged once, from a verified receipt, with an idempotency key.
  • [ ] A nightly job settles calls whose webhook never arrived (GET /v1/calls/{call_id}/receipt).
  • [ ] The rounding rule is shown to the user before the call.
  • [ ] Telehealth: consent stored by your app, pseudonymous ids, no health data sent to the video vendor.

Read more: the quickstart, telehealth video consultation app in India, and the full guide: per-minute paid video consultations in an astrology app.