Real World Example

UPI Payment Summary

A payments app like PhonePe or Paytm handles amounts, IDs, flags and sometimes very large transaction counters. Choosing the right primitive type matters.

Example

const txnId: string = "UPI-2026-000981";
const amountInRupees: number = 2499.5;
const successful: boolean = true;
const remark: string | null = null;
const totalTxnsOnPlatform: bigint = 13_120_000_000n;

console.log("Transaction:", txnId);
console.log("Amount: Rs.", amountInRupees.toFixed(2));
console.log("Status:", successful ? "SUCCESS" : "FAILED");
console.log("Remark:", remark ?? "none");
console.log("Platform total:", totalTxnsOnPlatform.toLocaleString("en-IN"));

Output

Transaction: UPI-2026-000981
Amount: Rs. 2499.50
Status: SUCCESS
Remark: none
Platform total: 13,12,00,00,000

Note: Real payment systems store money as whole paise (integers) to avoid floating point rounding errors, for example 249950 instead of 2499.5.