ACE AI Startup BootcampDay 9: Payment Service and Checkout Architecture
← Back to LMS Classroom
DAY 9 TEXTBOOKACE Startup SW/AI Pilot
ACE AI Startup Bootcamp Textbook Series 09

Payment Service and Checkout Architecture

A self-study textbook covering essential theory, comparative examples, guided practice, quality review, and a capstone exercise. Central question: How do we track and recover the movement of money without duplication or loss?

ACE AI Startup Bootcamp | Day 9Study Guide
HOW TO STUDY

Learning Goals and Study Routine

How do we track and recover the movement of money without duplication or loss? You complete today’s lesson when you can answer this question in your own words, produce the required artifact, and review its quality.

Theory: 60 minPractice: 90 minReview: 30 min
01

Model order and payment states separately.

02

Prevent duplicate charges with idempotency keys.

03

Distinguish authorization, capture, cancellation, and refund.

04

Handle webhook signatures and redelivery safely.

05

Design compensation for partial failures.

06

Detect monetary discrepancies through reconciliation and audit logs.

Recommended self-study routine

  1. Explain why a problem occurs before memorizing its terminology.
  2. Describe the difference between good and poor examples using observable criteria.
  3. Attempt the capstone before opening the model answer.
  4. Mark missing conditions in a second color and revise your artifact.
ACE AI Startup Bootcamp | Day 9Table of Contents
CONTENTS

Table of Contents

Completion standard

Submit the capstone artifact, score at least 80/100 on the self-review, and write your own answers to the four concept questions.

ACE AI Startup Bootcamp | Day 9Chapter 1 · Core Theory
CHAPTER 01

Core Theory: Payment Service and Checkout Architecture

Each technical term exists to solve a recurring design problem. Study when and why the concept is needed, not merely its definition.

Core conceptWorking definition
Payment IntentA business unit that represents and tracks a payment attempt.
AuthorizationApproval that funds are available for a charge.
CaptureThe step that actually collects an authorized amount.
Idempotency KeyAn identifier that prevents duplicate processing of one request.
WebhookAn asynchronous request notifying the server of a payment-state change.
ReconciliationComparison of internal ledgers with gateway settlement records.

Poor and Effective Approaches

Avoid

Create a new authorization every time the payment button is clicked and complete the order from the client response alone.

Prefer

Persist a payment intent and idempotency key, verify server and webhook state, and perform each allowed state transition once.

Design formula

[Server-calculated Total] → [Payment Intent] → [Idempotent Authorization] → [Verification] → [Order Transition] → [Webhook, Reconciliation, Refund]

ACE AI Startup Bootcamp | Day 9Chapter 2 · Guided Practice
CHAPTER 02

A Six-Step Design Workflow

1

Define the problem

Calculate the final amount on the server from products and discount rules.

2

Extract the structure

Store separate IDs and states for orders and payment attempts.

3

Design the core flow

Use an idempotency key and timeout for gateway calls.

4

Add failure conditions

Verify results on the server regardless of the client success screen.

5

Connect policies

Validate webhook signatures, event IDs, duplicates, and out-of-order delivery.

6

Verify and trace

Reconcile orders, payments, refunds, and fees against settlement data.

Worked Example

Payment state-transition example
CREATED -> AUTHORIZING -> AUTHORIZED -> CAPTURED | | v v FAILED REFUND_PENDING -> REFUNDED Rule: Repeating the same webhook for a CAPTURED payment must not change the ledger or order state again.

Questions for reading the example

  • Are the input and initiating condition explicit?
  • Are success and failure outcomes observable?
  • Are duplication, authorization, concurrency, and dependency failure covered as needed?
  • Can the result be traced back to a requirement?
ACE AI Startup Bootcamp | Day 9Chapter 3 · Review
CHAPTER 03

Concept Check and Quality Review

CONCEPT CHECK
  1. What breaks when order and payment states are combined?
  2. Why must a webhook signature be verified?
  3. Why must the server distrust an amount from the client?
  4. Why is reconciliation necessary beyond real-time processing?

Answer each in two or three sentences and add one example that supports your explanation.

Self-Assessment · 100 points

AreaStandardPoints
AccuracyConcepts and technical choices match the facts and requirements.25
CompletenessNormal flow, boundaries, failures, and recovery are covered.25
ConsistencyTerms, IDs, states, and interfaces agree across artifacts.20
VerifiabilityObservable outcomes and completion criteria are present.20
ReasoningThe choice and its tradeoffs can be explained clearly.10
If your score is below 80

Do not only correct the result. Record which question you failed to ask so your next design process prevents the same omission.

ACE AI Startup Bootcamp | Day 9Chapter 4 · Capstone
CHAPTER 04

Capstone Exercise and Model Answer

SUBMISSION

The user refreshes five times after payment and the gateway webhook arrives twice. Design the flow and include a network failure during refund.

  1. List assumptions and unresolved decisions first.
  2. Produce the main design as a table, diagram, or code block.
  3. Include the normal flow and at least three failures or boundaries.
  4. Score it with the rubric and compare before and after revision.
Open the model answer

Reuse an order-based idempotency key for client and gateway requests. Store webhook event IDs to ignore duplicates and permit only valid state transitions. Record REFUND_PENDING before calling the gateway, then confirm the final state through lookup or webhook.

How to use the answer

The model is not the only valid design. If yours differs, explain the requirement, cost, complexity, or risk that justifies your choice.

ACE AI Startup Bootcamp | Day 9Lesson Review
REVIEW

Glossary and Final Checklist

TermPlain-English meaning
PG / GatewayA provider that connects merchants with payment networks.
AuthorizationApproval to use an amount from a payment method.
CaptureActual collection of an authorized amount.
WebhookA request sent by an external service after a state change.
LedgerAn append-oriented record of monetary changes.
ReconciliationComparing payment records to discover differences.

Eight checks before submission

  1. Can you answer today’s central question in your own words?
  2. Are inputs, conditions, and results explicit?
  3. Did you include failures and recovery, not only the happy path?
  4. Did you review concurrency, duplicate requests, and permissions?
  5. Did you account for dependency failure and timeouts?
  6. Can you explain the disadvantages and alternatives to your choice?
  7. Are terminology and states consistent across artifacts?
  8. Is there an observable or testable completion standard?
Day 9 in one question

How do we track and recover the movement of money without duplication or loss? Answer it now using evidence from the artifact you created.

ACE AI Startup Bootcamp | Day 9Self-study reference
SELF-STUDY 01

Key Terms in Context

Learn each term as a decision tool. Read across each row: definition, reason to use it, and the failure it prevents.

TermPlain definitionWhy it mattersExample or caution
Payment gatewayA provider connecting merchants with cards, banks, and payment methods.It unifies authorization across payment rails.The server must verify the provider result directly.
Authorization and captureAuthorization reserves funds; capture submits the charge for settlement.They determine cancellation and settlement behavior.Do not reduce payment state to only success and failure.
WebhookAn asynchronous server notification about a payment state change.It updates final state even if the browser closes.Verify signatures and process duplicate events safely.
Idempotency keyA unique key identifying one logical payment attempt.It prevents duplicate charges during retries.Store the key and result by order.
PCI DSSA security standard for protecting cardholder data.It limits sensitive-data handling scope and responsibility.Avoid storing raw card numbers whenever possible.
ReconciliationMatching provider transactions with the internal ledger.It catches financial discrepancies.Define daily matching and an exception workflow.
Practice scenario

The user clicks Pay twice; the first response times out although the provider approves it, and a webhook arrives later.

ACE AI Startup Bootcamp | Day 9Guided practice
SELF-STUDY 02

Guided Practice and Troubleshooting

Practice scenario

The user clicks Pay twice; the first response times out although the provider approves it, and a webhook arrives later.

Complete in order

  1. Define order, payment, and refund states with allowed transitions.
  2. Attach an idempotency key and persist the server result.
  3. Verify webhook signatures and use them to confirm final state independently of redirects.
  4. Reconcile provider transactions with the internal ledger on a schedule.
Required evidence

Save one artifact, three assumptions, and at least three failure cases. A classmate should be able to reproduce your reasoning without asking what you meant.

If the result is wrong, diagnose it

Observed symptomLikely causeNext action
Duplicate chargeRetries are not identifiedOrder-scoped idempotency key
UI says failed but payment succeededOnly browser response is trustedServer lookup and webhook confirmation
Forged webhook acceptedSignature check missingVerify raw-body signature and timestamp
ACE AI Startup Bootcamp | Day 9Retrieval practice
SELF-STUDY 03

Check Your Understanding

Retrieval check — answer before opening

Why not trust the success page?

Browser responses can be interrupted or manipulated; the server must confirm with the provider.

Are void and refund always the same?

No. Pre-capture cancellation and post-capture refund can have different processing and settlement rules.

When is payment ready?

Duplicates, timeouts, webhooks, refunds, and reconciliation pass without money-state discrepancies.

Teach it back in two minutes

Explain the day's main decision, one failure mode, and one verification method without reading the page. If you cannot connect all three, return to the row or diagnostic case you missed.