Load account info, branches, wallet balance, and pricing.

flasho.account

flasho.account

bootstrap()

The recommended startup call. Returns everything in a single request โ€” account profile, wallet balance, pickup branches, pricing tiers, and scheduled delivery settings.

const data = await flasho.account.bootstrap();
 
console.log(data.account.sellerName);     // "My Restaurant"
console.log(data.account.walletBalance);  // "10.000"
console.log(data.account.billingMode);    // "PREPAID"
console.log(data.branches.length);        // 3
console.log(data.scheduledDelivery.available); // true

๐Ÿ’ก Use bootstrap at startup

Call this once when your app initialises rather than making separate calls to account, wallet, branches, and pricing.


get()

Returns the merchant profile.

const { account } = await flasho.account.get();
console.log(account.sellerId);     // "M001"
console.log(account.billingMode);  // "PREPAID"

listBranches()

Returns all pickup branches. Use isDefault to find the primary branch.

const { branches } = await flasho.account.listBranches();
 
const defaultBranch = branches.find(b => b.isDefault);
 
console.log(defaultBranch?.name);       // "Main Branch"
console.log(defaultBranch?.latitude);   // 29.3764
console.log(defaultBranch?.longitude);  // 47.9785

getWallet()

Returns wallet balance, billing mode, and recent transactions.

const wallet = await flasho.account.getWallet();
 
console.log(wallet.balance);      // "10.000"
console.log(wallet.billingMode);  // "PREPAID"
console.log(wallet.transactions[0].type);   // "DEBIT"
console.log(wallet.transactions[0].amount); // "2.500"

getPricing()

Returns distance-based pricing tiers and special zone overrides.

const pricing = await flasho.account.getPricing();
 
const { tiers, specialZones } = pricing.effectiveConfig;
console.log(tiers[0]); // { maxKm: 10, priceKwd: 1.25, label: "Up to 10 km" }

getScheduledDeliverySettings()

Check whether scheduled deliveries are available for your account before booking one.

const { scheduledDelivery } = await flasho.account.getScheduledDeliverySettings();
 
if (!scheduledDelivery.available) {
  throw new Error('Scheduled delivery is not enabled on this account');
}
 
console.log(scheduledDelivery.surchargeKwd); // "2.000"