Billing tools
All tool areas. Each tool acts within your access.
Billing
accept_operator_terms
Accept Lokl's operator terms for the organization, recorded with who and when. Only the current version is accepted (get_billing's operatorTerms.currentVersion). Needs billing:write across the organization: the owner who just created it holds that.
Changes · Members of an organization · Needs billing:write
Input
version
Output
versionacceptedAtbyby.idby.name
buy_ai_credits
Buy an AI credit top-up pack (1,000, 2,750, or 6,000 AI credits: US$10, US$25, US$50, or CA$12, CA$30, CA$60 for an organization billed in CAD; get_billing's packs are its own prices), plus tax. Applying makes a one-off invoice paid with the card in the dashboard (the output's clientSecret is for Stripe's Payment Element); the AI credits are added once it's paid, and never expire. Refused while online booking is paused (pay the overdue invoice, or choose a plan, first). Needs a billing address (given here or on file), and billing:write across the organization.
Changes · Members of an organization · Needs billing:write
Input
packThe top-up pack to buy (get_ai_credits lists the packs)
billingAddressThe billing address (Stripe's Address Element), saved for tax: Stripe Tax works the tax out from it. Needed the first time; later it replaces the one on file
billingAddress.line1billingAddress.line2billingAddress.citybillingAddress.statebillingAddress.postalCodebillingAddress.country
Output
clientSecretFor the Payment Element to pay the invoice
publishableKeyLokl's own Stripe publishable key, to load Stripe's Payment Element and Address Element on Lokl's account
choose_plan
Choose the organization's Lokl plan (starter, growth, or scale), billed per active location per month plus tax. A first plan starts now and is active once its first invoice is paid with the card in the dashboard (the output's clientSecret is for Stripe's Payment Element); chosen during the trial, it keeps the trial: the card is saved now (clientSecretKind setup) and the first charge is when the trial ends. A change of tier takes effect at the next period, with no proration. Cancelling is in Stripe's portal (get_billing_portal_link). Needs the operator terms accepted, a billing address (given here or on file), and billing:write across the organization.
Changes · Members of an organization · Needs billing:write
Input
tierThe plan: starter, growth, or scale (get_billing lists them)
billingAddressThe billing address (Stripe's Address Element), saved for tax: Stripe Tax works the tax out from it. Needed the first time; later it replaces the one on file
billingAddress.line1billingAddress.line2billingAddress.citybillingAddress.statebillingAddress.postalCodebillingAddress.country
Output
statusThe billing status now: unchanged until the first invoice is paid
clientSecretFor the Payment Element: the first invoice's payment (confirmPayment), or the card for after the trial (confirmSetup); null when there's nothing to give now (a change at the next period)
clientSecretKindpayment: call confirmPayment; setup: confirmSetup (the plan starts when the trial ends); null with no clientSecret
effectiveAtpublishableKeyLokl's own Stripe publishable key, to load Stripe's Payment Element and Address Element on Lokl's account
get_billing
Get what the organization pays Lokl: its billing status (trial, active, past due with the grace's end, limited, canceled), plan, trial end, current period, whether it cancels at the period's end, active locations billed, the price per location, the next invoice (before tax, tax, total), the card and billing address on file, the plans and AI credit top-up packs, the operator terms accepted, and what each location uses of the plan's limits (bookings this period and staff logins, with each limit; null is unlimited). Needs billing:read across the organization (owner and finance).
Reads · Members of an organization · Needs billing:read
No input.
Output
currencyWhat Lokl bills this organization in: CAD when its billing address is in Canada, else USD, fixed for good by its first plan or AI credit purchase. Until then it follows the billing address on file, or without one, CAD when every entity is CAD. Every price here (plans, packs, pricePerLocation, nextInvoice) is in it. Always sent
statustrialing: the 30-day trial, no card. active: paid. past_due: a payment failed; everything works until graceEndsAt. limited: the trial ended with no plan, or the grace ran out: online sales and in-app AI stop, everything else works; paying restores it at once. canceled: the plan ended after cancelling (online sales and in-app AI stop, as limited)
tierThe plan being paid for; comped is Lokl's own (no invoices). Null until a plan's first invoice is paid
pendingTierA plan chosen whose first invoice isn't paid yet, or that starts when the trial ends (choose_plan again with it to pay or save the card); null otherwise
scheduledTierThe plan from the next period on, when a change was chosen; null otherwise
trialEndsAtcurrentPeriodThe paid period now; null before the first
currentPeriod.startcurrentPeriod.endcancelAtPeriodEndCancelled in Stripe's portal: the plan ends at currentPeriod.end. Also true while pendingCurrencySwitch waits, when the plan carries on in the new currency instead
pendingCurrencySwitchA move to another billing currency Lokl set up (its own operator script): the plan carries on in
tofromat(the current period's end), same plan and locations, charged to the card on file; nothing is refunded or charged twice. Null when there's none. Always sentpendingCurrencySwitch.toISO 4217: the billing account's currency (USD or CAD), fixed by the billing address's country at the first purchase and never changed
pendingCurrencySwitch.athasSubscriptionWhether a subscription is billing the plan now; false after an unpaid currency switch or before a first plan: paying means choosing the plan
graceEndsAtWhile past_due: when online sales and in-app AI stop unless the invoice is paid
locationsBilledActive locations: the plan's quantity. A change shows on the next invoice (no proration)
pricePerLocationThe tier's price per location per month, before tax; null without a paid tier, and for comped
pricePerLocation.amountMinor units (cents) of
currencypricePerLocation.currencyISO 4217: the billing account's currency (USD or CAD), fixed by the billing address's country at the first purchase and never changed
nextInvoiceThe next invoice as Stripe previews it (tax by Stripe Tax); null with no subscription, when it ends at the period's end, or when Stripe couldn't be reached (providerReached false)
nextInvoice.datenextInvoice.subtotalBefore tax
nextInvoice.taxMinor units (cents) of
currencynextInvoice.totalMinor units (cents) of
currencynextInvoice.currencyISO 4217: the billing account's currency (USD or CAD), fixed by the billing address's country at the first purchase and never changed
cardThe card Lokl bills; null when none is on file
card.brandcard.last4card.expMonthcard.expYearbillingAddressThe billing address on file, for tax; null when there's none (choose_plan and buy_ai_credits then need one)
billingAddress.line1billingAddress.line2billingAddress.citybillingAddress.statebillingAddress.postalCodebillingAddress.countryproviderReachedFalse when Stripe couldn't be reached for the card, the address, and the next invoice, which are then null though they may exist
plansplans[]plans[].tierThe plan: starter, growth, or scale (get_billing lists them)
plans[].nameplans[].pricePerLocationPer active location per month, before tax
plans[].aiCreditsPerLocationAI credits per location per month, pooled across locations; what's left expires at the period's end
plans[].currencyISO 4217: the billing account's currency (USD or CAD), fixed by the billing address's country at the first purchase and never changed
packsAI credit top-ups; bought AI credits never expire
packs[]packs[].packThe top-up pack to buy (get_ai_credits lists the packs)
packs[].creditspacks[].priceBefore tax
packs[].currencyISO 4217: the billing account's currency (USD or CAD), fixed by the billing address's country at the first purchase and never changed
catalogVersionoperatorTermsoperatorTerms.currentVersionoperatorTerms.currentUpdatedThe date the terms in force were last updated: what people are shown, never currentVersion
operatorTerms.currentWhether the latest acceptance is of currentVersion: false when nobody has accepted, or the latest acceptance is of an older version (the dashboard then asks a member who may accept to accept the new one). Always sent
operatorTerms.acceptedThe latest acceptance (of any version); null when nobody has accepted them
operatorTerms.accepted.versionoperatorTerms.accepted.acceptedAtoperatorTerms.accepted.byoperatorTerms.accepted.by.idoperatorTerms.accepted.by.namepublishableKeyLokl's own Stripe publishable key, for the Address Element before any write
timeZoneThe organization's time zone, to show billing dates in
usageWhat each location uses of the plan's limits on bookings and staff logins
usage.periodStartWhen the bookings counted start: the paid period, the trial, or else the calendar month (UTC)
usage.periodEndWhen the count starts again
usage.locationsEvery location, including those with none yet
usage.locations[]usage.locations[].locationIdusage.locations[].nameusage.locations[].bookingsBookings taken this period: each confirmed order counts once, from when it was confirmed, even if it was canceled later. Going over never stops bookings; Lokl emails the owners at 80% and 100%
usage.locations[].bookings.countusage.locations[].bookings.limitWhat the plan includes at each location; null is unlimited
usage.locations[].staffLoginsPeople who can sign in to the dashboard here: members whose access reaches this location, plus invitations still open. Past the limit, nobody new can be given access here; nobody already here loses it
usage.locations[].staffLogins.countusage.locations[].staffLogins.limitWhat the plan includes at each location; null is unlimited
get_billing_portal_link
Get a link to Stripe's billing portal for the organization: the card Lokl bills, past invoices and receipts, and cancelling the plan at the period's end. The link works once, for a few minutes. Needs billing:write across the organization.
Reads · Members of an organization · Needs billing:write
No input.
Output
url
start_billing_trial
Start Lokl's 30-day free trial for an organization made before billing, which has no billing yet (get_billing answers not_found). No card is needed; the trial's 100 AI credits arrive at once. Refused when the organization already has billing. Needs billing:write across the organization (owner and finance).
Changes · Members of an organization · Needs billing:write
No input.
Output
statustrialEndsAt