Load account info, branches, wallet balance, and pricing.
flasho.account
flasho.account
bootstrap()
Call this once after login. It returns the profile, wallet, branches, pricing, and scheduled-delivery settings.
import { useEffect, useState } from 'react';
import { flasho } from './flasho';
export function useAccount() {
const [balance, setBalance] = useState<string>();
useEffect(() => {
flasho.account.bootstrap().then((data) => {
setBalance(data.account.walletBalance); // "10.000"
});
}, []);
return balance;
}Also on the result: account.sellerName, account.billingMode (PREPAID or POSTPAID), branches, and scheduledDelivery.available.
Other methods
| Method | Returns |
|---|---|
get() | Merchant profile (sellerId, billingMode) |
listBranches() | Pickup branches. The primary branch has isDefault: true. |
getWallet() | balance, billingMode, and transactions |
getPricing() | Distance tiers in effectiveConfig.tiers |
getScheduledDeliverySettings() | scheduledDelivery.available and surchargeKwd |
const { branches } = await flasho.account.listBranches();
const pickup = branches.find((b) => b.isDefault);