> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layoutmobile.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration flow

> How a customer order moves from app to payment and kitchen, and how Square and Layout stay in sync.

This page walks through the main flows: **customer order and payment**, **Square ↔ Layout sync**, **kitchen display**, and **engagement features**. It's conceptual — focused on what happens, not how it's built internally.

## Customer order and payment

1. **Customer** opens the branded app, picks a **location**, and browses the menu. Items that are sold out in Square are automatically reflected in the app.
2. **Cart and order** — The customer builds a cart and proceeds to checkout. If the customer selects a future pickup time, that slot is validated and stored with the order.
3. **Promotions and discounts** — Before payment, applicable discounts are evaluated and applied automatically. This includes welcome offers for first-time customers, any active in-app promotions, and Square-side discounts. The specifics of how eligibility is determined are handled by the backend.
4. **Checkout** — The app sends the order and payment details to the backend. The backend verifies the customer's identity, confirms the order is in a valid state, and creates the payment in Square using a unique key to prevent duplicate charges.
5. **Confirmation** — Square processes the payment; the order is confirmed and made available to the kitchen. The customer sees confirmation in the app.
6. **Post-checkout** — Loyalty balance is updated and the customer may receive a push notification confirming any points earned.

Payment always goes through Square. Layout never holds card data or settles funds.

## Gift cards

Customers can interact with Square gift cards entirely within the app:

* **Purchase** — Buy a new Square gift card from within the app.
* **Reload** — Add funds to an existing gift card.
* **Link** — Connect an existing physical gift card to the account.
* **Redeem** — Apply a gift card balance at checkout.
* **Designs** — Each merchant can configure a custom gift card design through the dashboard.

Gift card balances and data are always sourced from Square.

## Keeping Square and Layout in sync

* **At connect** — After Square OAuth is authorized, Layout syncs your locations and catalog immediately.
* **Event-driven** — When things change in Square (catalog, inventory, locations, loyalty), Square sends event notifications to Layout. We verify each one and update the relevant data for your account.
* **Daily scheduled sync** — A scheduled job runs every 24 hours as a backstop to catch anything that may have been missed, ensuring data stays accurate overnight.
* **Inventory** — Sold-out states update in near real-time when Square reports inventory changes.

Square is the source of truth. Layout reflects what's in Square — it never writes catalog or location data back.

## Loyalty

* Loyalty balance and program data sync both on a schedule and after relevant checkout actions.
* When a customer earns loyalty points, a push notification is automatically sent to let them know.
* Enrollment and redemption happen in the app; the backend coordinates with Square's Loyalty system.

## Kitchen display and order status

* **Layout KDS** — Staff open the kitchen panel, pick a location, and see that location's orders. Moving an order through status (accepted → making → ready → completed) updates what the customer sees in the app, and can trigger a push notification or iOS Live Activity on their lock screen.
* **Square KDS** — If you use Square's kitchen display only, the app shows order confirmation and an estimated pickup time.
* **Square Expeditor** — A workflow variant where Square's fulfillment transitions map to Layout's status model, suited for counter-service operations.

## End-to-end picture

```
Customer app          Backend               Square
     |                   |                    |
     |  Place order       |                    |
     |------------------>|                    |
     |  (Discounts,       |                    |
     |   pickup time)     |                    |
     |                   |  Create payment    |
     |                   |------------------->|
     |                   |<-------------------|
     |  Order confirmed  |                    |
     |<------------------|                    |
     |                   |  Loyalty sync      |
     |                   |<-------------------|
     |  (Push, status,   |                    |
     |   Live Activity)  |                    |
     |<------------------|                    |

Catalog / locations:  Square --> (events + daily sync) --> Layout --> App & Dashboard
Inventory:            Square --> (inventory events)     --> Layout --> App (sold-out)
Gift cards:           Square <-> Layout backend <-> Customer app
Kitchen:              Layout panel <-> order status <-> Customer app (Layout KDS)
```

## What this means for shop owners

* **Your menu is always current** — Changes in Square appear in the app automatically. No manual syncing needed.
* **Payments stay in Square** — Every dollar processed goes through your Square account. Layout never touches settlement.
* **Orders are reliable** — The system is designed so duplicate taps, network retries, and edge cases don't result in double charges or lost orders.
* **Your kitchen workflow stays yours** — Whether you use Layout KDS, Square KDS, or Square Expeditor, orders flow to where your team already works.

For more on Square sync and connection, see [Square integration](/integrations/square). For reliability and payment safety, see [Reliability](/reliability).
