Lightspeed K-Series
Use the Lightspeed K-Series integration to connect your Lightspeed POS with Mathership. The integration imports Lightspeed locations and POS items, lets you map POS items to ingredients or recipes, and creates inventory ledger entries from POS sales.Connect Lightspeed
Map POS items
Create ledger entries
What the integration can do
The integration can:- Connect Lightspeed through OAuth
- Store Lightspeed access and refresh tokens securely
- Refresh Lightspeed tokens automatically
- Reauthorize an existing connection when needed
- Sync Lightspeed business locations
- Sync Lightspeed POS items
- Link Lightspeed locations to Mathership storage units
- Map Lightspeed items to ingredients or recipes
- Run a 90-day historical migration
- Run automatic daily transfers
- Run manual one-day transfers
- Create inventory ledger entries from POS sales
- Keep transfer logs for review and troubleshooting
What the integration does
When a Lightspeed transfer runs, Mathership:- Fetches Lightspeed sales for one location and one date
- Stores the raw Lightspeed sales and sales lines
- Reads the sold POS item names and quantities
- Finds matching POS mappings in Mathership
- Deducts mapped ingredients directly
- Expands mapped recipes into recipe ingredients
- Calculates inventory quantities
- Creates inventory ledger entries
- Links created ledger entries back to the Lightspeed sales lines
- Stores a transfer log with statistics, errors, skipped lines, and unmapped items
What the integration does not do
The Lightspeed integration does not:- Create ingredients automatically
- Create recipes automatically
- Guess item mappings automatically
- Deduct inventory for unmapped items
- Optimize stock levels
- Change Lightspeed sales data
- Push inventory back to Lightspeed
- Create purchase orders
- Calculate delivery routes
Recommended setup order
Use this order for a clean Lightspeed setup:Link locations to storage units
Before you start
Before connecting Lightspeed, prepare these Mathership inventory objects.| Required setup | Why it is needed |
|---|---|
| Storage units | Inventory deductions need a target storage unit |
| Ingredients | POS items or recipe lines deduct ingredients |
| Recipes | Recipe-mapped POS items are exploded into ingredients |
| POS mappings | Lightspeed item names need to be linked to ingredients or recipes |
Storage units
Each Lightspeed location must be linked to one Mathership storage unit. The storage unit defines where inventory should be deducted.| Lightspeed location | Mathership storage unit |
|---|---|
| Restaurant Main POS | Main Kitchen |
| Bar POS | Bar Storage |
| Terrace POS | Terrace Storage |
Ingredients
Ingredients are the inventory objects that are deducted.| Ingredient | Unit |
|---|---|
| Coffee beans | kg |
| Cola bottle 0.33 l | bottle |
| Burger bun | piece |
| Tomato | kg |
Recipes
Recipes are used when one sold POS item consists of several ingredients. When the Lightspeed item is sold, Mathership deducts the ingredients inside the recipe.| Lightspeed item | Mathership recipe |
|---|---|
| Classic Burger | Classic Burger recipe |
| Pizza Margherita | Pizza Margherita recipe |
| Espresso Martini | Espresso Martini recipe |
Connect Lightspeed
Mathership stores access and refresh tokens securely. Tokens are refreshed automatically when they expire.Required connection data
When the integration is created, Mathership needs:| Field | Meaning |
|---|---|
company_id | The company that owns the integration |
name | Internal name for the integration |
code | OAuth authorization code from Lightspeed |
What happens during connection
During connection, Mathership:- Receives the OAuth authorization code
- Sends the code to the Lightspeed token endpoint
- Receives an access token and refresh token
- Encrypts the tokens before storing them
- Creates the integration and marks it as active
Token handling
| Token | Use |
|---|---|
| Access token | Used for Lightspeed API calls |
| Refresh token | Used to receive a new access token |
| Access token expiry | Stored from the Lightspeed response |
| Refresh token expiry | Stored from the Lightspeed response |
Connection errors
| Error | Meaning |
|---|---|
lightspeed_integration_exists | A Lightspeed integration already exists for this company |
lightspeed_oauth_exchange_failed | The authorization code could not be exchanged |
lightspeed_not_configured | Lightspeed OAuth is not configured correctly |
unauthorized_company_access | The company does not belong to the current user |
Common connection problems
Integration already exists
Integration already exists
Authorization code failed
Authorization code failed
OAuth is not configured
OAuth is not configured
Reauthorize Lightspeed
Use reauthorization when an existing Lightspeed connection needs fresh authorization without losing your setup. This is needed when:- The refresh token expired
- Lightspeed invalidated the token
- Token refresh failed repeatedly
- The integration status changed to disconnected
- Synced locations and storage-unit links
- Synced items and item mappings
- Transfer history and migration history
- Existing logs
Token refresh behavior
If a Lightspeed API call returns401, Mathership attempts to refresh the token automatically and retries the request once.
| Refresh outcome | Result |
|---|---|
| Success | New tokens stored, integration stays active, open alerts resolved |
Fails with invalid_grant | Integration marked as disconnected, reauthorization required |
| Fails with server error | Integration marked as refresh failed, alert raised, may be retryable |
Sync locations
The location sync fetches business locations from Lightspeed and flattens them into a Mathership location list.Location list columns
| Column | Description |
|---|---|
| Location ID | Lightspeed business location ID |
| Name | Location name with country and timezone |
| Storage unit | Linked Mathership storage unit, or Unmapped |
| Currency | Currency code from Lightspeed |
| Activated | Whether the location is activated for daily issues |
| Auto issue | Whether automatic daily processing is active or paused |
| Last synced | When the location was last synced |
Stored location data
| Field | Meaning |
|---|---|
business_location_id | Lightspeed business location ID |
name | Lightspeed location name |
country | Location country from Lightspeed |
timezone | Location timezone from Lightspeed |
currency_code | Currency code from Lightspeed |
last_synced_at | Last location sync time |
Locations that disappear from Lightspeed
If a location no longer appears in the Lightspeed API, Mathership does not automatically delete it during sync. This avoids accidental loss of:- Storage-unit links
- Mapping context
- Transfer history
- Migration history
Common location sync problems
Locations are missing
Locations are missing
Location name changed in Lightspeed
Location name changed in Lightspeed
Link a storage unit
Each Lightspeed location must be linked to a Mathership storage unit before transfers can deduct inventory. The same sold item can deduct inventory from different storage units depending on the location.| Lightspeed location | Storage unit | Result |
|---|---|---|
| Bar POS | Bar Storage | Drinks deducted from bar stock |
| Restaurant POS | Main Kitchen | Food deducted from kitchen stock |
| Terrace POS | Terrace Storage | Terrace sales deduct terrace stock |
Unlink a storage unit
You can remove the storage-unit link again. Do this only if the location should no longer deduct inventory from that storage unit. If a location is unbound during a migration, the migration can be cancelled.Storage-unit errors
| Error | Meaning |
|---|---|
storage_unit_required | A storage unit must be linked before activation or transfer |
storage_unit_company_mismatch | The selected storage unit belongs to another company |
location_has_no_storage_unit | Transfer cannot run because the location has no storage unit |
Sync items
Mathership fetches items for every synced Lightspeed location and deduplicates them by Lightspeed item ID across locations.Item list columns
| Column | Description |
|---|---|
| Name | POS item name and Lightspeed item ID |
| SKU | SKU from Lightspeed, if available |
| Price | Item price synced from Lightspeed |
| Active | Whether the item is active in Lightspeed |
| Mapped | Whether the item has a Mathership mapping |
| Mapped to | The ingredient or recipe the item maps to, with quantity and subtraction flag |
| Locations | Which Lightspeed locations this item appears in |
Stored item data
| Field | Meaning |
|---|---|
item_id | Lightspeed item ID |
name | Lightspeed item name |
sku | SKU from Lightspeed, if available |
active | Whether the item is active |
price | Item price, if available |
last_synced_at | Last item sync time |
prices.amount, prices.value, prices.price, price, and costPrice.
If no usable price is found, the item is stored without a price.
Item states
| State | Meaning |
|---|---|
| Not mapped | The item has no inventory mapping yet |
| Mapped | The item is mapped to an ingredient or recipe |
Common item sync problems
Items are missing
Items are missing
Item name changed in Lightspeed
Item name changed in Lightspeed
Map Lightspeed items
Click any item row to open the mapping sheet. Each Lightspeed item must be mapped before it can create inventory movements. You can map an item to:- An ingredient — the ingredient is deducted directly per sale
- A recipe — the recipe is expanded into its ingredients and all lines are deducted
Why mapping is required
Without a mapping, Mathership can store the sale but cannot create the correct inventory deduction.| Lightspeed sale | Required Mathership meaning |
|---|---|
| Espresso | Deduct coffee beans |
| Cola 0.33 l | Deduct one Cola bottle |
| Classic Burger | Deduct all ingredients in the burger recipe |
Mapping examples
- Ingredient mapping
- Recipe mapping
| Lightspeed item | Mapped to | Mapping qty | Sale qty | Inventory effect |
|---|---|---|---|---|
| Cola 0.33 l | Cola bottle | 1 | 2 | 2 bottles |
| Espresso | Coffee beans | 0.009 | 10 | 0.09 kg coffee beans |
| Burger | Burger recipe | 1 | 3 | 3 recipe portions |
Mapping quantity
The mapping quantity controls how much inventory is deducted per sold POS item.| Lightspeed item | Mapping target | Mapping quantity | Sale quantity | Inventory effect |
|---|---|---|---|---|
| Cola 0.33 l | Cola bottle | 1 | 2 | 2 bottles |
| Espresso | Coffee beans | 0.009 | 10 | 0.09 kg coffee beans |
| Burger | Burger recipe | 1 | 3 | 3 recipe portions |
Mapping fields
| Field | Meaning |
|---|---|
mapped_object_type | ingredient or recipe |
mapped_object_id | ID of the ingredient or recipe |
quantity | Multiplier used for the mapped object |
is_subtraction | Whether the mapping uses reversal/subtraction logic |
Subtraction mapping
Useis_subtraction carefully for special cases such as reversal logic, negative sales, or corrections.
Update or delete a mapping
To update a mapping, open the item, select a new ingredient or recipe, adjust the quantity, and save. Mathership replaces the existing mapping. To delete a mapping, open the item, remove the mapping, and save. The item will no longer create inventory deductions.Mapping errors
| Error | Meaning |
|---|---|
recipe_not_found | The selected recipe does not exist for this company |
ingredient_not_found | The selected ingredient does not exist for this company |
unauthorized_company_access | The item or integration does not belong to the current user |
Activate a location
A Lightspeed location must be activated before migration and regular transfer processing can run. Before activation, make sure:- The location has a storage unit
- Important Lightspeed items are mapped
- Recipes and ingredients are set up correctly
- You understand which storage unit will receive the deductions
Location detail page
Opening a location shows a live overview of its health, activity, and configuration.Health indicators
If any of the following are detected, a warning banner appears at the top of the page:- No storage unit linked
- Recent transfers have failed
- Recent transfers contain unmapped items
- A migration is currently in progress
Stats
| Stat | Description |
|---|---|
| Issues (lifetime) | Total issues ever processed with failure count |
| Issues (7d / 30d) | Issues processed in the last 7 and 30 days |
| Catalog mapped | How many Lightspeed items are mapped out of total — click to open the products page |
| Sales (7d / 30d) | Lightspeed sales lines seen in the last 7 and 30 days |
Configuration
| Setting | Description |
|---|---|
| Storage unit | The storage unit where inventory is deducted — click Save after changing |
| Activate location | One-way toggle to activate the location for daily issues |
| Auto issue | Toggle to pause or resume automatic daily processing |
| Manual issue | Date picker to trigger a one-off issue for a specific past date |
90-day migration
When a location is activated, Mathership creates a 90-day historical migration that processes past Lightspeed sales and creates inventory movements where mappings exist.Migration date range
The default migration range is the last 90 completed days, ending yesterday.| Example | Date |
|---|---|
| If today is | 2026-05-08 |
| Start date | 2026-02-07 |
| End date | 2026-05-07 |
| Total days | 90 |
Migration job creation
When a migration job is created, Mathership creates one day status for each date in the 90-day range. Each day can have its own status. If a successful transfer log already exists for a date, that day can be marked as skipped for the initial migration.Migration job statuses
| Status | Meaning |
|---|---|
pending | Migration has been created but not started |
running | Migration is currently processing |
completed | Migration finished successfully |
cancelled | Migration was cancelled |
failed | Migration finished but one or more days failed |
Migration day statuses
| Status | Meaning |
|---|---|
pending | Day is waiting to be processed |
processing | Day is currently being processed |
success | Day was processed successfully |
no_data | Lightspeed returned no sales data for that day |
failed | Day failed during processing |
retry_pending | Failed day is waiting for retry |
skipped | Day was skipped because a successful transfer already exists |
Migration progress fields
| Field | Meaning |
|---|---|
total_days | Number of days in the migration |
days_processed | Days successfully processed |
days_failed | Days that failed |
days_skipped | Days skipped because prior success existed |
current_date | Date currently being processed |
start_date | First date in the migration |
end_date | Last date in the migration |
progress_percent | Migration progress percentage |
started_at | Start timestamp |
completed_at | Completion timestamp |
error_message | Error message for failed or cancelled jobs |
Migration actions
| Action | When to use |
|---|---|
| Start migration | When no migration exists for the location |
| Re-run migration | After adding or correcting mappings — reprocesses the full 90-day range |
| Cancel migration | When you need to stop a pending or running migration |
Recover stuck migrations
Mathership can reset stuck migration jobs. A running job is considered stuck if it has been running for too long. When recovered, the job is moved back topending so processing can continue.
Retry failed migration days
Mathership can retry failed migration days automatically. Retries are limited by attempt count. If all failed days later succeed, the migration job is marked ascompleted.
Re-run migration is useful when:
- Many items were unmapped during the first migration
- Ingredient or recipe mappings were corrected
- Storage or recipe setup was fixed
- Failed days need to be processed again
Migration errors
| Error | Meaning |
|---|---|
location_not_activated | The location must be activated first |
storage_unit_required | The location has no linked storage unit |
migration_already_in_progress | A migration is already pending or running |
Automatic transfer
Once a location is activated, Mathership processes Lightspeed sales automatically each day. Toggle Auto issue in the Configuration section to pause or resume it.| State | Meaning |
|---|---|
| Active | Daily Lightspeed sales are processed automatically |
| Paused | No automatic processing — manual issues still work |
- Mappings are incomplete or being corrected
- A storage-unit link is wrong
- You are investigating unexpected inventory movements
- Lightspeed authorization needs to be repaired
- You want to prevent automatic deductions temporarily
Manual transfer
Use manual transfer when you want to process one specific day. Manual transfer is useful for:- Testing the integration before enabling automatic transfer
- Reprocessing a day after mapping changes
- Fixing inventory after a failed transfer
- Checking a specific Lightspeed sales date
Force refresh behavior
Manual transfers fetch fresh data from Lightspeed by default. When force refresh is active, Mathership:- Fetches fresh sales data from Lightspeed
- Updates the cached Lightspeed sales and sales lines
- Deletes existing ledger entries for the same Lightspeed sales lines and current storage unit
- Recreates inventory ledger entries from the latest data
Idempotency
Lightspeed transfers are designed to avoid duplicate ledger entries. Mathership links created inventory ledger entries to Lightspeed sales lines. On later runs, already-posted sales lines are skipped for the current storage unit unlessforce_refresh is used.
What happens during transfer
When a Lightspeed transfer runs, Mathership:- Checks that the location has a storage unit
- Creates a transfer log
- Fetches or reuses Lightspeed sales for the selected date
- Stores Lightspeed sales and sales lines
- Reads sold item names and quantities
- Skips lines already posted to the current storage unit
- Matches sold item names to POS mappings
- Deducts mapped ingredients directly
- Expands mapped recipes into ingredients
- Calculates weighted average cost
- Creates inventory ledger entries
- Links ledger entries to Lightspeed sales lines
- Updates the POS integration last run time
- Saves transfer statistics and errors
Sales date window
Mathership requests Lightspeed sales for the selected report date using a full-day UTC window.Sales line processing
Only positive sales lines with a name are processed. A sales line is skipped when:- Quantity is missing, zero, or negative
- Item name is missing
- The line was already posted
- The item is unmapped
- The mapped ingredient or recipe cannot be resolved
POS mapping match
The transfer matches Lightspeed sales lines to POS mappings by POS item name. The Lightspeed sales line name must exactly match the mapped POS item name.Transfer result
A manual transfer returns a summary with the following information:| Field | Meaning |
|---|---|
date | Processed report date |
success | Whether the transfer succeeded |
no_data | Whether Lightspeed returned no sales data |
log_id | Transfer log reference |
ledger_ids | Created inventory ledger entry IDs |
stats | Processing statistics |
error | Error message if processing failed |
Transfer statistics
| Field | Meaning |
|---|---|
sales_count | Number of Lightspeed sales processed |
lines_processed | Number of sales lines processed |
lines_skipped | Number of sales lines skipped |
ledger_entries_created | Number of inventory ledger entries created |
exceptions | Mapping or recipe processing issues |
used_cache | Whether cached sales were used |
idempotent | Whether no new entries were needed because lines were already posted |
recipes_used | Summary of mapped recipes or ingredients used |
unmapped_names | POS item names without mappings |
api_response_summary | Summary of fetched or cached Lightspeed data |
No data result
If Lightspeed has no data for the selected date, the transfer returnsno_data.
This usually means:
- No sales were found for that location and date
- The wrong date was entered
- The wrong location was selected
- Lightspeed did not return report data for that day
Transfer errors
| Error | Meaning |
|---|---|
date_required | No date was provided |
invalid_date_format | The date format is invalid |
storage_unit_required | The location has no linked storage unit |
location_has_no_storage_unit | The selected location cannot deduct inventory |
lightspeed_auth_failed | Lightspeed authentication failed |
lightspeed_api_error | Lightspeed API returned an error |
max_retries_exhausted | Transfer failed after all retry attempts |
Retry behavior
For temporary Lightspeed API errors, Mathership retries the transfer automatically with the following delay sequence:| Retry attempt | Delay |
|---|---|
| 1 | 30 seconds |
| 2 | 60 seconds |
| 3 | 120 seconds |
429 rate limit responses.
Processing logic
Ingredient mapping
If the mapping points to an ingredient, Mathership deducts that ingredient directly.| Lightspeed item | Quantity sold | Mapping quantity | Inventory deduction |
|---|---|---|---|
| Cola 0.33 l | 12 | 1 | 12 bottles |
| Espresso | 20 | 0.009 | 0.18 kg coffee beans |
Recipe mapping
If the mapping points to a recipe, Mathership explodes the recipe and deducts all recipe ingredients.| Lightspeed item | Quantity sold | Mapping | Inventory deduction |
|---|---|---|---|
| Burger | 5 | Burger recipe | Ingredients for 5 burgers |
| Pizza Margherita | 3 | Pizza recipe | Ingredients for 3 pizzas |
invalid_trim_pct exception.
If recipes reference each other in a cycle, Mathership stops the recursive expansion and records a recipe_cycle exception.
Unmapped items
If a sold Lightspeed item has no mapping, Mathership records the item name as unmapped and does not create any inventory deduction. Example exception:unmapped_pos_name:Espresso
Weighted average cost
Mathership calculates unit cost from receipt ledger entries using: total receipt value / total receipt quantity If no receipt quantity is available, the unit cost is0.
Inventory ledger entries
Lightspeed transfers create inventory ledger entries of type ISSUE. Each entry is linked to:- Company and ingredient
- Storage unit
- Quantity deducted
- Unit cost and total value
- Date
- Lightspeed location
- Transfer log
- Lightspeed sales line
| Lightspeed sale | Mapping | Inventory result |
|---|---|---|
| 1 × Espresso | Coffee beans | Deduct coffee beans |
| 2 × Cola 0.33 l | Cola bottle | Deduct 2 bottles |
| 1 × Burger | Burger recipe | Deduct all burger ingredients |
Transfer logs
Each transfer attempt creates a transfer log. Open logs from the See all logs button on the location detail page.| Field | Meaning |
|---|---|
| Location | Lightspeed location |
| Report date | Date being processed |
| Request UUID | Shared identifier for the transfer request |
| Attempt number | Retry attempt number |
| Status | Processing, success, or failed |
| Ledger IDs | Created inventory ledger entries |
| Sales processed | Number of sales |
| Lines processed | Number of lines processed |
| Lines skipped | Number of skipped lines |
| Unmapped names | POS names without mappings |
| Error message | Failure reason |
| Response summary | Exceptions, recipes used, and API summary |
Integration alerts
Mathership raises integration alerts for Lightspeed failures. Alerts are deduplicated — repeated failures update the existing open alert instead of creating duplicates. When the integration recovers, open alerts are resolved automatically.| Alert code | Meaning |
|---|---|
disconnected | Refresh token is invalid and reauthorization is required |
token_refresh_failed | Token refresh failed because of an auth or server error |
Testing checklist
Before relying on automatic transfers, test one day manually and check that:- The correct Lightspeed location was used
- The location has the correct storage unit
- The correct date was processed
- Sold items were found
- Important items are mapped
- Recipe ingredients were deducted correctly
- Quantities are correct
- Ledger entries appear in the correct storage unit
- Unmapped item names are expected
- Transfer log status is successful
- No unexpected exceptions appear
Suggested test process
Best practices
Set up inventory first
Start with one location
Map high-volume items first
Test manually first
Review unmapped items
Keep item names stable
Use reauthorization
Check ledger results
Common problems
Lightspeed connection already exists
Lightspeed connection already exists
Authorization failed
Authorization failed
Integration becomes disconnected
Integration becomes disconnected
Locations are missing
Locations are missing
Items are missing
Items are missing
Location cannot be activated
Location cannot be activated
Migration does not start
Migration does not start
Transfer creates no inventory entries
Transfer creates no inventory entries
Some items are skipped
Some items are skipped
unmapped_names, create or correct mappings, check recipe ingredients, re-run the manual transfer with force refresh, and re-run migration if historical data should be corrected.Wrong storage unit was used
Wrong storage unit was used
- Pause automatic transfer
- Correct the storage-unit link and save
- Review existing ledger entries for the affected dates
- Decide whether affected days should be reversed or reprocessed
- Run manual transfer carefully after correction
Item is mapped but still not deducted
Item is mapped but still not deducted
Manual transfer says no data
Manual transfer says no data