DEV Community
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 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 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. 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. 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. Treat the usage figure as an input, not a fact. The 0.8 GB/day here is a parame...
Powered by Readybot.io
External Link
Platform
You are about to visit:
https://example.comThis will open in a new tab. Make sure you trust this link.