01.retail_buyer
- Back
- 00.overview.md
-
01.admin
- 00.overview.md
-
01.auth
-
02.user-management
-
03.group-management
-
04.announcement-management
-
05.guide-management
-
02.general
- 00.overview.md
-
01.analysis
-
02.auth
-
03.chat
-
04.checkout
-
00.general
- 00.overview.md
-
01.retail_buyer
-
02.subscription
-
-
05.packages
-
06.wishlist
- 00.overview.md
-
01.temp-wishlist-to-group
-
02.wishlist-to-group
-
07.file-storage
-
08.unique-product-upload
-
09.dataset-workflow
-
10.landing-page
-
11.download-review-csv
-
03.widget
sequenceDiagram
actor User
participant UI as TV Console UI
participant API as TV API
participant Stripe
participant DB as TV Console DB
participant Webhook as Stripe Webhook
participant Slack
User->>UI: Access TV Console
User->>UI: Select package plan<br/>(Basic/Standard/Premium)
User->>UI: Confirm buy plan
UI->>API: Request create order
API->>DB: Check if user has payment_provider_customer_id
alt No Stripe Customer ID
API->>Stripe: Create Customer
Stripe-->>API: Return Customer ID
API->>DB: Update user with payment_provider_customer_id
end
API->>Stripe: Create Checkout Session<br/>(with customer ID)
Stripe-->>API: Return Session ID
API->>DB: Create wishlist to user record<br/>Create order history (unpaid)
DB-->>API: Confirm saved
API-->>UI: Return Checkout Session ID
UI->>Stripe: Redirect to payment form
User->>Stripe: Fill payment info
Note over Stripe,Webhook: Payment Processing
alt Successful Payment
rect rgb(230, 230, 255)
Webhook->>API: Webhook: checkout.session.completed
API->>DB: Transaction begin
API->>DB: Update order history<br/>(payment_intent_id, invoice_id,<br/>status, payment_status, paid_at)
API->>DB: Update wishlist status to active
API->>DB: Transaction commit
API->>Slack: Send notification of successful purchase
API-->>UI: Return success status
UI-->>User: Show success message
end
else Failed Payment
rect rgb(255, 200, 200)
Note over Webhook,API: Payment fails in Stripe
API->>DB: Update order history<br/>(status: failed)
API-->>UI: Return error status
UI-->>User: Show failure message<br/>with retry option
end
end