StoicBuilder
Later missionMission 10: Keys in the drawerYou can practise it now. It counts once you reach mission 10, after “What Place order actually sends”.Back to HQ
Exit lesson
Environment variables & secretsProLesson 11 of 45, about 6 min
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
0 XP

The app: QuickBite

QuickBitelocalhost:3000
Bangkok Garden, Thai25–35 min
Pad thaiRice noodles, tamarind, peanuts. $11.50 each
2 
2× Pad thai$23.00
Delivery$2.99
Total$25.99

Deliver to 12 Elm Street

The data behind it

checkout.js runs in the browser
1const API_KEY = "qb_live_DEMO1234";2 3async function placeOrder(order) {4 await fetch("https://api.payments.example/charges", {5 method: "POST",6 headers: { Authorization: `Bearer ${API_KEY}` },7 body: JSON.stringify({ amount: order.total, currency: "usd" }),8 });9}
Downloaded by every visitor View source shows this
const k="";async function p(o){await fetch("https://api.payments.example/charges",{method:"POST",headers:{Authorization:`Bearer ${k}`},body:JSON.stringify({amount:o.total,currency:"usd"})})}
Request the browser will sendPOST payments not sent yet
{ "url": , "headers": { "Authorization": }, "body": { "amount": , "currency": } }

The MagisterOn the left, QuickBite’s checkout, running on your laptop. On the right, the code your agent wrote to charge the card. It sends a secret key to the payments service. Place the order, then tap the key in what the browser sent.

Step 1 of 7Place the order, then find the key
  • Place the order
  • Tap the key in the request

You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.