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

# Scan-to-Pay Checkout

> End-to-end flow for shopping mall mobile apps, H5 QR checkouts, and third-party payment aggregators.

Use this recipe when drivers scan a QR code inside a shopping mall or enter their license plate / paper ticket number in your mobile app to pay for parking.

## Integration Sequence

```mermaid theme={null}
sequenceDiagram
  autonumber
  participant Driver as "Driver App / H5"
  participant Partner as "Partner Backend"
  participant AKE as "AKE Parking API"

  Driver->>Partner: "Enter plate or scan ticket"
  Partner->>AKE: "POST /v1/fees/quote"
  AKE-->>Partner: "quoteId, appliedValidations, payableAmount, expiresAt"
  Partner-->>Driver: "Show fee summary and pay button"
  Driver->>Partner: "Authorize payment (Stripe / Wallet)"
  Partner->>AKE: "POST /v1/payments/notify (with Idempotency-Key)"
  AKE-->>Partner: "status: SUCCEEDED, exitAllowedUntil"
  Partner-->>Driver: "Display grace period countdown"
```

## Implementation Checklist

**1. Lookup active session and fee quote**

If the user does not remember their full license plate, call `POST /v1/sessions/listActive` with a partial `credentialQuery` (`>= 3` characters) to offer plate autocomplete, then call `POST /v1/fees/quote`.

**2. Handle zero-fee sessions**

If `payableAmount.amount === 0` (for example within the initial grace period or fully waived by a dining validation), display the remaining grace period directly without opening a payment checkout.

**3. Handle concurrent on-site payments gracefully**

A driver might pay at an on-site kiosk while a mobile checkout is pending. Always pass a unique `Idempotency-Key` on `POST /v1/payments/notify`. If the facility returns `409 Conflict` (`ALREADY_PAID`), automatically trigger a refund in your payment gateway. If the exit grace period expires later and overstay charges accrue, requesting `POST /v1/fees/quote` returns the incremental `payableAmount` so the driver can top up on the same `sessionId`.

**4. Refresh expired quotes**

Every quote carries an `expiresAt` timestamp (typically 5 minutes). If checkout takes longer, `POST /v1/payments/notify` returns `422` (`QUOTE_EXPIRED`); request a fresh quote before capturing funds.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.