Homework
Homework — pay for the order
Homework — pay for your order (test mode).
- Stripe test keys. Create a (free) Stripe account, grab the test publishable key (
pk_test_...) and put it inPaymentConfiguration.init. The server uses the matching secret key (sk_test_...). - Pay. Cart → "Pay" → PaymentSheet → test card
4242 4242 4242 4242, a future date, any CVC → "Payment complete! 🍕". - Check the ordering. Confirm the order appears only after a successful payment. Cancel the PaymentSheet (the "X") — the order should not appear (
PaymentCanceledclearsclientSecret, andplaceOrderisn't called). - Stripe Dashboard. Under "Payments" in test mode you'll see your test payment with its amount. That amount must match the cart total.
Required tests:
- Success test:
4242…→ order recorded, visible in history. - Cancel test: canceled payment → no order, the cart remains.
- Decline test: card
4000 0000 0000 0002(Stripe "decline") →PaymentFailed, you see the error, not a crash.
To submit: screenshots: (1) the Stripe PaymentSheet, (2) "Payment complete", (3) the payment in the Stripe Dashboard test mode.
Next. Pica is functionally complete: QR → menu → cart → login → order → payment → history. In lesson 12 we polish and ship: consistent states, error handling, a signed release (signing, R8), and a signpost on when Clean Architecture is worth it.