@startuml
autonumber
actor "Customer" as User
participant "Storefront" as Web
participant "Order API" as API
participant "Payments" as Pay
participant "Warehouse" as Stock
User -> Web : Place order
Web -> API : POST /orders
API -> Stock : Check availability
Stock --> API : Items available
group Inventory reservation
API -> Stock : Reserve items
Stock --> API : reservation_id
end
API -> Pay : Create payment
alt Payment succeeded
Pay --> API : payment.succeeded
API -> Stock : Confirm reservation
API --> Web : Order confirmed
Web --> User : Thank you for your order!
else Payment declined
Pay --> API : payment.failed
API -> Stock : Release reservation
API --> Web : Offer payment retry
end
@enduml