Diagram Desk

Coupon checkout sequence diagram

Applying a coupon at checkout: the coupon service checks it and returns the discount, with an alt branch for missing or expired coupons.

The diagram

Order serviceCoupon serviceEnter coupon codeValidate coupon3,000 won offUpdated totalNot usableCoupon errorBuyeralt [Valid][Expired or unknown]
Sequence diagram · 3 shapes

Reading it step by step

  • 1. 'Buyer' sends a request to 'Order service': 'Enter coupon code'.
  • 2. 'Order service' sends a request to 'Coupon service': 'Validate coupon'.
  • [alt: Valid]
  • 3. 'Coupon service' replies to 'Order service': '3,000 won off'.
  • 4. 'Order service' replies to 'Buyer': 'Updated total'.
  • 5. 'Coupon service' replies to 'Order service': 'Not usable'.
  • 6. 'Order service' replies to 'Buyer': 'Coupon error'.

Shape by shape

ShapeSymbolConnections
BuyerActor→ Order service(Enter coupon code) · ← Order service, Order service
Order serviceParticipant and lifeline→ Coupon service(Validate coupon), Buyer(Updated total), Buyer(Coupon error) · ← Buyer, Coupon service, Coupon service
Coupon serviceParticipant and lifeline→ Order service(3,000 won off), Order service(Not usable) · ← Order service

Symbols used here

SymbolMeaning
Participant and lifelineA box on top and a dashed line below.
ActorA human participant; a stick figure.
Synchronous messageA call that waits; solid line, filled head.
ReplyThe answer; dashed line, open head.
Combined fragmentloop, alt and opt boxes.

All sequence diagram symbols and how to draw

Diagram text

Paste this text into the editor to get the same picture, then change the names to fit your own work.

# Coupon checkout sequence diagram
sequenceDiagram
  actor C as Buyer
  participant O as Order service
  participant K as Coupon service
  C->>O: Enter coupon code
  O->>K: Validate coupon
  alt Valid
    K-->>O: 3,000 won off
    O-->>C: Updated total
  else Expired or unknown
    K-->>O: Not usable
    O-->>C: Coupon error
  end

More sequence diagram examples

All SeewolLabs tools