Build with AI
Paste one of these prompts into your AI coding assistant (ChatGPT, Claude, Gemini, GitHub Copilot, Cursor…), together with your website’s code, and it will build the integration. Use the copy button at the top right of each prompt.
- Create a publishable key in ALWS RESTRO (Account Setting → API Keys) with your website’s address as an allowed website. Create a secret key too if your site has a server and you want online payments.
- Pick the prompt that matches your website below and replace the parts in
[square brackets]. - Review what the AI writes, test it with a real order, and then cancel the test order in ALWS RESTRO.
Online ordering (pay at pickup or cash on delivery), order tracking and table booking, with no server code.
You are adding online ordering and table booking to my restaurant website using the ALWS RESTRO Restaurants API.
MY WEBSITE- Type: [static HTML/CSS/JavaScript | React | Vue | other: ___]- Pages/files to change: [list them, or say "create new pages"]- Style: match the existing design (fonts, colours, buttons).
API FACTS (follow exactly)- Base URL: https://restro.alws.in/api/v1- Auth header on every request: Authorization: Bearer [pk_live_PASTE_PUBLISHABLE_KEY] This is a publishable key: it is safe in browser code and only works on my allowed website.- JSON in and out. Money is INR. Times are India Standard Time.- Full contract (read it if you can browse): https://developers.alws.in/restaurants/openapi.json- GET /menu -> { currency, categories:[{name,itemCount}], items:[{id,name,category,price,foodType:"veg"|"egg"|"nonveg"|null}] }- POST /orders/quote body { items:[{itemId,quantity}], couponCode? } -> { items:[{itemId,name,unitPrice,quantity,lineTotal}], subtotal, discount|null, charges:[{name,percentage,amount}], roundOff, total }- POST /orders body { items, orderType:"pickup"|"delivery", customer:{name,phone,email?}, deliveryAddress?:{line,landmark?,city?,pincode?} (required for delivery), notes?, couponCode?, payment:{method:"cash"}, expectedTotal:<quote.total> } Header Idempotency-Key: a new crypto.randomUUID() per order, reused on retries of the same order. -> 201 { id, orderNumber, status, statusText, total, ..., accessToken }- GET /orders/{id} with header X-Order-Token:<accessToken> -> current status/statusText. Statuses: pending, processing, shipped, delivered, cancelled.- POST /orders/{id}/cancel with X-Order-Token (only works while status is pending).- GET /reservations/availability?date=YYYY-MM-DD&from=HH:mm&to=HH:mm -> { availableCount, tables:[{tableId,tableNumber,floorName,available}] }- POST /reservations body { date, from, to, partySize?, customer:{name,phone,email?}, notes?, tableId? } Header Idempotency-Key. -> 201 { id, table:{tableNumber}, date, from, to, accessToken }- POST /reservations/{id}/cancel with header X-Reservation-Token:<accessToken>- Errors: { error:{ code, message, requestId, details? } }. Show error.message to the user. 409 price_changed -> show details.quote.total and ask the customer to confirm again. 422 item_unavailable / coupon_invalid -> explain and let them fix the cart. 429 -> wait Retry-After seconds. Retry network errors and 500s up to 3 times with the SAME Idempotency-Key.
BUILD1. Menu page: load GET /menu once, group by category, show veg/non-veg marks, add-to-cart with quantity.2. Cart: keep it in localStorage. Whenever it changes (or a coupon is entered), call POST /orders/quote and show subtotal, discount, each charge, round-off and total from the response. Never calculate prices yourself.3. Checkout: pickup or delivery, name, phone, optional email, address for delivery, optional notes. Validate phone (10-digit Indian mobile or +91 format). Disable the button while sending. Send POST /orders with expectedTotal = the total shown and an Idempotency-Key.4. Confirmation page: show orderNumber and total. Save {id, accessToken, orderNumber} in localStorage.5. "My orders" / order status page: GET /orders/{id} with X-Order-Token; refresh every 30 seconds while open; show statusText; offer "Cancel order" only while status is pending.6. Table booking: date (today to 60 days ahead), from/to time, party size, name, phone. Check availability first, then POST /reservations. Show the table number. Save {id, accessToken}; allow cancelling before the start time.7. Accessibility and mobile: labelled form fields, large tap targets, works on a phone.
RULES- Never put any key starting with sk_ in browser code.- Do not invent endpoints or fields that are not listed above.- Keep all API calls in one small module (e.g. alws-api.js) with a single fetch helper that adds the headers, parses errors and retries as described.Everything above, plus online payment confirmed by your server with the secret key.
You are integrating my restaurant website with the ALWS RESTRO Restaurants API, including online payments.
MY STACK- Frontend: [Next.js | React + Node/Express | PHP | Django | other: ___]- Payment gateway: [Razorpay | PhonePe | Cashfree | other: ___] (I already have an account)- Hosting: [Vercel | Hostinger | other: ___]
API FACTS (follow exactly)- Base URL: https://restro.alws.in/api/v1 ; full contract: https://developers.alws.in/restaurants/openapi.json- Publishable key (browser OK): [pk_live_PASTE_PUBLISHABLE_KEY]- Secret key: read it ONLY on the server from the environment variable ALWS_SECRET_KEY. Never send it to the browser, never log it. The API rejects secret keys sent from a browser (403 secret_key_in_browser).- Menu, quote, orders, order status/cancel and table booking work exactly as in the plain-site prompt: GET /menu, POST /orders/quote, POST /orders, GET /orders/{id} (+X-Order-Token), POST /orders/{id}/cancel, GET /reservations/availability, POST /reservations, POST /reservations/{id}/cancel.- Online payment flow: 1. Browser: POST /orders with payment:{method:"online"}, expectedTotal and an Idempotency-Key. The order is created as status "pending_payment" and is NOT shown to the restaurant yet. 2. Server: create the payment with my gateway for exactly order.total (in paise if the gateway needs it), store the ALWS order id with the gateway order. 3. Browser: open the gateway checkout. 4. Server: verify the payment with the gateway (signature check or webhook). Only after verification call POST /orders/{id}/payment with Authorization: Bearer <ALWS_SECRET_KEY> body { provider:"[Razorpay]", reference:<gateway payment id>, amount:<order.total> }. -> the order becomes status "pending", paymentStatus "paid" and appears in ALWS RESTRO. Repeating this call for an already-paid order is safe (returns the order unchanged). 5. If verification fails or the customer abandons payment, do not call the payment endpoint; you may POST /orders/{id}/cancel.- Server-only extras with the secret key: GET /orders?status=&since=&limit= lists orders (newest first); GET /orders/{id} works without X-Order-Token.- Errors: { error:{ code, message, requestId, details? } }. Log requestId on the server. 409 amount_mismatch means the amount sent is not the order total. 409 not_awaiting_payment: order was cancelled or already paid.
BUILD1. Shared API module on the server with fetch helper, timeouts (10 s), retries (3, with backoff) for network errors, 429 and 500, keeping the same Idempotency-Key on retries.2. Menu, cart, checkout, confirmation, order status and table booking pages as in a standard online-ordering site; always show prices from POST /orders/quote, never compute them.3. Payment routes on the server: create-payment, verify-payment (and the gateway webhook if supported), which call POST /orders/{id}/payment only after verification.4. Environment variables: ALWS_SECRET_KEY, gateway keys. Add them to .env.example without real values.5. Tests for the payment verification route (valid signature, invalid signature, amount mismatch).
RULES- Do not invent endpoints or fields. Do not store card data. Do not trust prices or totals sent by the browser.A small plugin with shortcodes for the menu, ordering and table booking.
Create a WordPress plugin "ALWS RESTRO Online Ordering" for my restaurant site using the ALWS RESTRO Restaurants API.
API FACTS- Base URL: https://restro.alws.in/api/v1 ; contract: https://developers.alws.in/restaurants/openapi.json- Publishable key (used in the browser): stored in a plugin settings page (Settings → ALWS RESTRO).- Optional secret key for server-side calls: also in plugin settings, stored as a WordPress option, never printed into page HTML or JavaScript. Use wp_remote_get / wp_remote_post for server calls.- Endpoints: GET /menu, POST /orders/quote, POST /orders (with Idempotency-Key and expectedTotal), GET /orders/{id} (+X-Order-Token), POST /orders/{id}/cancel, GET /reservations/availability, POST /reservations, POST /reservations/{id}/cancel. Order body: { items:[{itemId,quantity}], orderType:"pickup"|"delivery", customer:{name,phone,email?}, deliveryAddress?:{line,city?,pincode?}, notes?, couponCode?, payment:{method:"cash"}, expectedTotal }.- Errors: { error:{ code, message, requestId } } — show message to the visitor.
BUILD- Shortcodes: [alws_menu] (menu + cart + checkout), [alws_order_status], [alws_table_booking].- Enqueue one small vanilla-JS file and one CSS file only on pages that use the shortcodes.- Prices always from POST /orders/quote. Keep the cart in localStorage.- Escape all output (esc_html, esc_attr), use nonces for any admin form, sanitize settings.- Mobile-friendly and accessible forms. No jQuery requirement.
RULES- Do not invent endpoints or fields. Never expose the secret key to the browser.A short prompt that gives the assistant the API in its context, for when you want to ask your own questions.
Learn this API, then help me with my question.
ALWS RESTRO Restaurants API — base URL https://restro.alws.in/api/v1 — JSON, INR, India Standard Time.Contract: https://developers.alws.in/restaurants/openapi.json — guide: https://developers.alws.in/restaurants/llms.txtAuth: Authorization: Bearer <key>. pk_live_ keys: browser-safe, locked to allowed websites, orders always start unpaid,read/cancel an order or booking only with its accessToken (X-Order-Token / X-Reservation-Token).sk_live_ keys: server only (rejected from browsers); can list orders and mark online orders paid.Endpoints: GET /restaurant, GET /menu, POST /orders/quote, POST /orders, GET /orders, GET /orders/{id},POST /orders/{id}/cancel, POST /orders/{id}/payment (sk), GET /tables, GET /reservations/availability,POST /reservations, GET /reservations/{id}, POST /reservations/{id}/cancel, GET /health.Create calls accept Idempotency-Key (same key on retry = no duplicate). Send expectedTotal with orders (409 price_changed).Order statuses: pending_payment (online, hidden until paid), pending, processing, shipped, delivered, cancelled.Errors: { error:{ type, code, message, requestId, details? } }. Rate limits per key per minute: pk 120 (20 creates), sk 600 (120 creates).
My question: [ask here]Checklist before going live
Section titled “Checklist before going live”- The publishable key lists every address your site uses (with and without
www). - No
sk_live_key appears in any browser code, app, or code repository. - Totals shown to customers come from
POST /orders/quote, and orders sendexpectedTotal. - Orders and bookings send an
Idempotency-Key, reused on retries. - Online payments: your server verifies the payment with the gateway before calling
POST /orders/{id}/payment. - A real test order shows up in ALWS RESTRO under Website Orders, and a test booking under Reservations. Cancel both afterwards.
