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

# Integration Flow

> Complete step-by-step guide to onboarding a customer through Wilow

## Full Flow

```
1. Check Coverage      →  Is the user's location served?
2. Link Customer       →  Register/auth the user, get their token
3. Save Address        →  Store their pickup/delivery address
4. Set Preferences     →  Their laundry preferences per service
5. List Plans          →  Show available subscription plans
6. Get Available Days  →  Show pickup days/periods for chosen plan
7. Subscribe           →  Create the subscription (state: draft)
8. Confirm Payment     →  Mark payment done → subscription goes active
```

***

## Step 1 — Check Coverage

Before showing anything, confirm Wilow operates in the user's area.

```http theme={null}
POST /external-partner/customers/is-location-covered
```

If `is_covered: false`, show an out-of-coverage message. Don't proceed.

***

## Step 2 — Link Customer

Register or authenticate the user on Wilow's side. If the user already exists (matched by mobile), Wilow returns their existing account.

```http theme={null}
POST /external-partner/customers/link-customer
```

**Store the returned `auth_token`** — you'll need it for all remaining steps.

***

## Step 3 — Save Address

Save the user's address using their customer token. This becomes their default pickup/delivery location.

```http theme={null}
POST /external-partner/customers/address
```

<Note>
  Run location coverage check again here if the user changes their address.
</Note>

***

## Step 4 — Set Laundry Preferences

Let the user configure how they want their laundry handled. Call once per service type (`clothes`, `shoes`, `ironing`).

```http theme={null}
POST /external-partner/customers/laundry-preferences
```

This step can be skipped — Wilow applies sensible defaults — but capturing preferences improves the customer experience.

***

## Step 5 — List Plans

Fetch the available subscription plans to display to the user.

```http theme={null}
GET /external-partner/plans
```

Each plan has multiple **plan types** (e.g. "1 wash", "4 washes") with pricing. Present these as purchase options.

***

## Step 6 — Get Available Days

Once the user picks a plan type, fetch which pickup days and periods are available.

```http theme={null}
GET /external-partner/subscription/available-days?orders_count={plan_orders_count}
```

Pass `orders_count` from the selected plan type. The response returns available days with `morning` and `evening` period options.

***

## Step 7 — Subscribe

Create the subscription. The user picks a plan, plan type, and preferred pickup day + period.

```http theme={null}
POST /external-partner/subscription/subscribe
```

The subscription is created in `draft` state. **No laundry is scheduled yet** — payment must be confirmed first.

***

## Step 8 — Confirm Payment

After the user pays through your payment flow, confirm the payment to Wilow.

```http theme={null}
POST /external-partner/subscription/confirm-payment
```

On success, the subscription moves to `active` state and Wilow begins scheduling pickups. The response includes an invoice PDF URL.

***

## Subscription States

| State    | Meaning                                        |
| -------- | ---------------------------------------------- |
| `draft`  | Created, awaiting payment confirmation         |
| `active` | Payment confirmed, pickups are being scheduled |

***

## Notes

* **Preferred pickup day vs date**: The subscribe endpoint accepts either a recurring `preferred_pickup_day` (e.g. `monday`) or a one-time `preferred_pickup_date`. At least one is required.
* **Same-day orders**: If a customer needs a same-day pickup, contact Wilow support directly — these are handled manually.
