Calculate delivery price quotes before booking.
flasho.pricing
flasho.pricing
calculate()
Get a price estimate before creating a delivery. Shows the customer the fee at checkout.
On-demand quote
const { quote } = await flasho.pricing.calculate({
fromLatitude: 29.3764,
fromLongitude: 47.9785,
toLatitude: 29.3117,
toLongitude: 48.0034,
});
console.log(quote.price); // "1.250"
console.log(quote.currency); // "KWD"
console.log(quote.distance); // 4.2
console.log(quote.distanceUnit); // "km"
console.log(quote.estimatedDuration); // 12 (minutes)
console.log(quote.tierLabel); // "Up to 10 km"Scheduled quote
Set isScheduled: true to get the flat rate instead of the distance-based price.
const { quote } = await flasho.pricing.calculate({
fromLatitude: 29.3764,
fromLongitude: 47.9785,
toLatitude: 29.3117,
toLongitude: 48.0034,
isScheduled: true,
});
console.log(quote.price); // "2.000"
console.log(quote.pricingMode); // "scheduled"
console.log(quote.tierLabel); // "Scheduled delivery (flat rate)"With area hints
Pass deliveryArea or deliveryPaciArea to improve accuracy when the drop-off is near a special zone boundary.
const { quote } = await flasho.pricing.calculate({
fromLatitude: 29.3764,
fromLongitude: 47.9785,
toLatitude: 29.3117,
toLongitude: 48.0034,
deliveryArea: 'Salmiya, Block 3',
deliveryPaciArea: 'Salmiya',
});Request parameters
| Field | Required | Description |
|---|---|---|
fromLatitude | ✓ | Pickup latitude |
fromLongitude | ✓ | Pickup longitude |
toLatitude | ✓ | Drop-off latitude |
toLongitude | ✓ | Drop-off longitude |
deliveryArea | — | Area string — improves zone detection |
deliveryPaciArea | — | PACI area name |
isScheduled | — | true for scheduled flat rate |
Typical integration pattern
// 1. Get quote to show customer
const { quote } = await flasho.pricing.calculate({
fromLatitude: pickupLat,
fromLongitude: pickupLng,
toLatitude: dropoffLat,
toLongitude: dropoffLng,
});
// 2. Show the price in your checkout UI
console.log(`Delivery fee: ${quote.price} KWD`);
// 3. Create the delivery when customer confirms
const { delivery } = await flasho.deliveries.create({
customerName,
customerNumber,
pickupLatitude: pickupLat,
pickupLongitude: pickupLng,
deliveryLatitude: dropoffLat,
deliveryLongitude: dropoffLng,
});