Once all pizzas are added and the customer has chosen carry out or delivery, the app asks a single question: “Will you be paying with cash or card?” The answer to this question determines which of two distinct checkout paths the conversation follows. The cash path ends the order immediately with a short confirmation message. The card path collects three card fields, shows a simulated approval, and — for delivery orders only — asks for an optional driver tip before completing the order.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/alex-pizza-assistant/llms.txt
Use this file to discover all available pages before exploring further.
Cash Checkout
WhenpaymentMethod normalizes to "cash", advanceStep() calls finishOrder() immediately. No card fields are ever shown. The bot’s response message in respondToAnswer() depends on the order method:
- Delivery — the bot says: “Your driver will collect your cash payment upon delivery.”
- Carry out — the bot says: “Please pay for your order when you pick it up.”
advanceStep() calls finishOrder() and the session ends.
Card Checkout
WhenpaymentMethod normalizes to "card", the step pointer advances to cardNumber and three card-specific steps run in sequence.
cardNumber
The customer enters their credit or debit card number. Leading/trailing spaces and hyphens are stripped by
normalizeValue() before validation. The validator requires 13–19 digits after stripping: /^\d{13,19}$/.Only the last four digits are stored. saveAnswer() sets order.cardLastFour = value.slice(-4). The full card number is never saved to the order object.cardExpiration
The customer enters the card expiration date in
MM/YY format. The validator is /^(0[1-9]|1[0-2])\/\d{2}$/, which requires a valid two-digit month (01–12) followed by a two-digit year. The expiration date is not stored on the order object — it is validated and discarded.Card field validation reference
| Field | Validator | Example valid input |
|---|---|---|
cardNumber | 13–19 digits after stripping spaces/hyphens | 4111 1111 1111 1111 |
cardExpiration | /^(0[1-9]|1[0-2])\/\d{2}$/ | 09/27 |
cardCvv | /^\d{3,4}$/ | 123 or 1234 |
Driver Tip
The tip step is only reached when both of the following are true:order.method === "delivery" and order.paymentMethod === "card". advanceStep() checks order.method immediately after cardCvv to decide whether to route to tip or call finishOrder() directly.
isValidMoney():
3), decimals up to two places (3.50), and values prefixed with a dollar sign ($3.50). An entry of 0 is also accepted — no tip is a valid answer. The normalizeValue() function strips the $ sign and casts the result to a Number before it is stored as order.tip, which is then added to the grand total in calculateTotals().
The tip step is skipped entirely for carry out orders regardless of payment method, and for delivery orders that are paid with cash. The cash delivery confirmation message already informs the customer that the driver will collect payment — asking for a card tip in that scenario would be contradictory. Only delivery + card orders reach the tip question.
Payment Normalization
ThepaymentMethod step accepts a wider range of natural inputs than the two canonical values "cash" and "card". normalizeValue() collapses all variants:
| Raw input | Normalized to |
|---|---|
cash | "cash" |
card | "card" |
credit | "card" |
debit | "card" |
credit card | "card" |
debit card | "card" |
"card" or is exactly "credit" or "debit" resolves to "card". Everything else — in practice only "cash" — stays as-is. The branching logic in advanceStep() exclusively checks for the string "card" to route to card fields, so this normalization step is essential for all credit/debit variants to work correctly.