Dev.to WebDev ๐Ÿ›  Dev ๐Ÿ‘ 0 ๐Ÿ“– 3 min read

Pricing a multi-country trip from a public per-GB rate feed (and why the cheapest rate isn't your price)

I work at NXTL eSIM, which publishes the endpoint used here. It's a public, read-only price list: no key, no account. If you build anything that quotes mobile data for travellers (a trip planner, a booking flow, an expe

I work at NXTL eSIM, which publishes the endpoint used here. It's a public, read-only price list: no key, no account.

If you build anything that quotes mobile data for travellers (a trip planner, a booking flow, an expense estimate), you hit the same problem quickly: per-GB rates differ by network, not just by country. A single "Italy: รขโ€šยฌ0.64/GB" figure is a lower bound, not a price.

This post prices a trip from a public rate feed in about 30 lines of Node, and prints the range you should show users.

The data

GET https://nxtlsim.com/wp-json/nxtl-app/v1/pricing/countries returns one row per country (183 on 16 Nov 2026):

// one row, trimmed (rows also carry min_usd/max_usd)
{ "country": "Italy", "min_eur": 0.639, "max_eur": 2.1955, "networks": 4,
  "min_display": "รขโ€šยฌ0.64", "max_display": "รขโ€šยฌ2.20" }

Top-level fields include total and ledger_currency: "EUR". The same data, with ISO codes and an updated timestamp, is in nxtlsim.com/ai/pricing.json (rates updated 14 Oct 2026 at the time of writing). The human version is the pricing page.

The script

// node trip-cost.mjs "Italy:7" "France:4" "Spain:3" --gb-per-day 0.8
const API = 'https://nxtlsim.com/wp-json/nxtl-app/v1/pricing/countries';
const args = process.argv.slice(2);
const i = args.indexOf('--gb-per-day');
const gbPerDay = i >= 0 ? Number(args[i + 1]) : 0.8;
const legs = args.filter((a, k) => a.includes(':') && k !== i + 1)
  .map(a => { const [country, days] = a.split(':'); return { country, days: Number(days) }; });

const res = await fetch(API);
if (!res.ok) throw new Error(`pricing endpoint returned ${res.status}`);
const { countries, ledger_currency } = await res.json();

let low = 0, high = 0;
for (const leg of legs) {
  const r = countries.find(c => c.country.toLowerCase() === leg.country.toLowerCase());
  if (!r) { console.log(`${leg.country}: not in the price list, check the spelling`); continue; }
  const gb = leg.days * gbPerDay;
  low += gb * r.min_eur; high += gb * r.max_eur;
  console.log(`${r.country.padEnd(10)} ${String(leg.days).padStart(2)} days  ${gb.toFixed(1).padStart(5)} GB  ` +
    `${r.networks} networks  รขโ€šยฌ${r.min_eur.toFixed(2)}รขโ‚ฌโ€œรขโ€šยฌ${r.max_eur.toFixed(2)}/GB  รขโ€ โ€™ รขโ€šยฌ${(gb * r.min_eur).toFixed(2)}รขโ‚ฌโ€œรขโ€šยฌ${(gb * r.max_eur).toFixed(2)}`);
}
console.log(`Trip total (${ledger_currency}): รขโ€šยฌ${low.toFixed(2)} at the lowest listed rates, up to รขโ€šยฌ${high.toFixed(2)} at the highest.`);

Node 18+ (global fetch, top-level await in .mjs).

Output

$ node trip-cost.mjs "Italy:7" "France:4" "Spain:3" --gb-per-day 0.8
Italy       7 days    5.6 GB  4 networks  รขโ€šยฌ0.64รขโ‚ฌโ€œรขโ€šยฌ2.20/GB  รขโ€ โ€™ รขโ€šยฌ3.58รขโ‚ฌโ€œรขโ€šยฌ12.29
France      4 days    3.2 GB  4 networks  รขโ€šยฌ0.63รขโ‚ฌโ€œรขโ€šยฌ2.35/GB  รขโ€ โ€™ รขโ€šยฌ2.02รขโ‚ฌโ€œรขโ€šยฌ7.53
Spain       3 days    2.4 GB  3 networks  รขโ€šยฌ0.63รขโ‚ฌโ€œรขโ€šยฌ0.73/GB  รขโ€ โ€™ รขโ€šยฌ1.52รขโ‚ฌโ€œรขโ€šยฌ1.75
Trip total (EUR): รขโ€šยฌ7.12 at the lowest listed rates, up to รขโ€šยฌ21.58 at the highest.

$ node trip-cost.mjs "United States:5" "Japan:5" --gb-per-day 1
United States  5 days    5.0 GB  4 networks  รขโ€šยฌ1.00รขโ‚ฌโ€œรขโ€šยฌ41.22/GB  รขโ€ โ€™ รขโ€šยฌ5.00รขโ‚ฌโ€œรขโ€šยฌ206.08
Japan       5 days    5.0 GB  2 networks  รขโ€šยฌ2.38รขโ‚ฌโ€œรขโ€šยฌ2.61/GB  รขโ€ โ€™ รขโ€šยฌ11.92รขโ‚ฌโ€œรขโ€šยฌ13.07
Trip total (EUR): รขโ€šยฌ16.93 at the lowest listed rates, up to รขโ€šยฌ219.15 at the highest.

What I'd take from this into a real product

  1. Show a range, not just the minimum. The US row is the reason: the same country spans รขโ€šยฌ1.00 to รขโ€šยฌ41.22 per GB depending on the network. If your UI shows only the minimum, users will be surprised.
  2. Say which control moves the user within the range. For NXTL there are two: an account-level network preference (Cheapest / Best coverage, neither a price ceiling, docs) and manual operator selection on the phone (docs). Your provider will have its own equivalents.
  3. Keep currencies apart. The rates are EUR/GB, while the consumer starter is sold from a USD catalogue (US$11.99 including US$10.00 of usable balance). Don't silently convert one into the other in your UI.
  4. Treat the usage figure as an input, not a fact. The 0.8 GB/day here is a parameter. Our open-source Trip Data Budget planner builds it from hours per activity and shows the assumptions; its source is a single static HTML file you can read (repo).
  5. Cache with a date. The planner falls back to a bundled snapshot when the endpoint is unreachable and labels it with its check date. Do the same.

If you're building a reseller or booking integration

Price lookup is the easy, public part. Issuing eSIMs, usage and balances go through the Business API for approved business accounts (integration overview, API reference). Our MIT-licensed SDKs, @nxtlsim/esim-sdk and nxtl-esim (both v0.1.0), wrap that API. Their markup, rounding, customer and wallet helpers run locally in your process: NXTL doesn't host those records, and the README lists which API responses still lack a published schema. Source: github.com/nxtlsim/nxtl-esim-sdk.

Disclosure: I work at NXTL eSIM. Figures are from the live endpoint on 16 Nov 2026 (rates updated 14 Oct 2026); rates change.

๐Ÿ“ฐ Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.