```mermaid sequenceDiagram participant User as 사용자 participant Controller as 결제Controller participant Service as 결제Service participant Gateway as 결제Gateway participant DB as 데이터베이스 User->>Controller: 결제 요청 Controller->>Service: 결제 처리 요청 Service->>Gateway: 결제 요청 전달 Gateway->>Service: 결제 결과 Service->>DB: 결제 정보 저장 DB-->>Service: 저장 결과 Service-->>Controller: 결제 처리 결과 Controller-->>User: 결제 결과 응답 rect rgb(200, 200, 200) Note over Service: Commit 경계 end rect rgb(255, 0, 0) Note over Service: Rollback 처리 end Note over User, Gateway: 외부 실패 시 Gateway-->>Service: 실패 응답 Service-->>Controller: 결제 실패 응답 Controller-->>User: 결제 실패 알림 Note over Service, DB: DB 실패 시 Service-->>DB: 저장 실패 DB-->>Service: 저장 실패 응답 Service-->>Controller: 결제 실패 응답 Controller-->>User: 결제 실패 알림 ```