Theme Postman Doc: https://documenter.getpostman.com/view/20499442/[merchant-collection-id] ================================================================================ SECTION 1: MASTER THEMES APIs ================================================================================ Master themes are global theme templates available in the marketplace. -------------------------------------------------------------------------------- API: Fetch Master Themes -------------------------------------------------------------------------------- GET /merchant/api/v1/themes?domain_id={{domain_id}} Description: List all available master themes from the marketplace. Can filter by theme_plan (free/premium) and include domain-specific flags like already_added. Query Parameters: - domain_id (required): Domain ID to check already_added status - theme_plan (optional): Filter by "free" or "premium" - page (optional): Page number for pagination - size (optional): Page size - order (optional): Sort order Response: 200 OK [ { "id": "6799ca2d2accf568166dd6dc", "name": "Layout 1", "layout_id": "LAYOUT_1", "description": "A detailed description of Layout 1.", "preview_images": ["https://ik.imagekit.io/unizap/..."], "cms_page": "https://demo.example.com/theme-1", "default_theme_path": "../themes/theme-1", "price": 0, "currency": "INR", "subscription_level": "PROFESSIONAL", "position": 1, "features_tag": ["Mega Menu", "Infinite Scroll"], "business_module": ["Quick Commerce"], "is_default": true, "is_active": true, "is_featured": false, "is_promoted": false, "usage_counter_total": 100, "demo_url": "https://demo.example.com/theme-1", "keywords": ["tag-1", "responsive", "modern"], "rating_average": 4.5, "total_reviews": 5, "already_added": true } ] Flow Sequence: # Step 1: Validate Token POST /api/auth/token/verify [User Service] # Step 2: Fetch Master Themes GET /api/themes [Theme Service / Utility Service] # Step 3: If domain_id provided, enrich with already_added flag GET /api/storefront-themes?domain_id=:domain_id [Theme Service] -------------------------------------------------------------------------------- API: Get Master Theme -------------------------------------------------------------------------------- GET /merchant/api/v1/themes/:theme_id Description: Get detailed information about a specific master theme. Path Parameters: - theme_id (required): Master theme ID Response: 200 OK { "id": "673f15332534d01b0cdf2039", "name": "Theme 1", "description": "A detailed description of Theme 1.", "preview_images": ["https://cdn.example.com/themes/theme-1-preview1.jpg"], "cms_page": "https://demo.example.com/theme-1", "default_theme_path": "../themes/theme-1", "price": 0, "currency": "INR", "subscription_level": "PROFESSIONAL", "position": 1, "features_tag": ["Mega Menu", "Infinite Scroll"], "business_module": ["Quick Commerce"], "is_default": true, "is_active": true, "demo_url": "https://demo.example.com/theme-1", "keywords": ["tag-1", "responsive", "modern"], "rating_average": 4.5, "total_reviews": 5 } Flow Sequence: # Step 1: Validate Token POST /api/auth/token/verify [User Service] # Step 2: Fetch Master Theme by ID GET /api/themes/:theme_id [Theme Service / Utility Service] ================================================================================ SECTION 2: STOREFRONT THEMES APIs ================================================================================ Storefront themes are domain-specific theme instances. -------------------------------------------------------------------------------- API: List Storefront Themes -------------------------------------------------------------------------------- GET /merchant/api/v1/domains/:domain_id/themes Description: List all themes installed/configured for a specific domain. Path Parameters: - domain_id (required): Domain ID Response: 200 OK [ { "id": "673f1f862534d01b0cdf203e", "theme_id": "6799ca2d2accf568166dd6dc", "domain_id": "673ed463e1b7500c994a3c33", "default_theme_path": "../themes/theme-3", "status": "DRAFT", "is_active": true, "last_published_at": "2024-10-20T12:34:56", "created_at": "2024-11-21T11:10:43.447Z", "updated_at": "2024-11-21T11:10:43.447Z" } ] Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Fetch Storefront Themes for Domain GET /api/storefront-themes?domain_id=:domain_id [Theme Service] -------------------------------------------------------------------------------- API: Create Storefront Theme -------------------------------------------------------------------------------- POST /merchant/api/v1/domains/:domain_id/themes Description: Install a master theme to a domain, creating a storefront theme instance. Path Parameters: - domain_id (required): Domain ID Request Body: { "theme_id": "6799ca2d2accf568166dd6dc", "default_theme_path": "../themes/theme-3", "status": "DRAFT", "is_active": true, "last_published_at": "2024-10-20T12:34:56" } Response: 201 Created { "id": "673f1f862534d01b0cdf203e", "theme_id": "6799ca2d2accf568166dd6dc", "domain_id": "673ed463e1b7500c994a3c33", "default_theme_path": "../themes/theme-3", "status": "DRAFT", "is_active": true } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Validate Master Theme exists GET /api/themes/:theme_id [Theme Service] # Step 3: Create Storefront Theme POST /api/storefront-themes [Theme Service] # Step 4: Initialize theme assets and configuration POST /api/storefront-themes/:id/initialize [Theme Service] -------------------------------------------------------------------------------- API: Purchase Storefront Theme -------------------------------------------------------------------------------- POST /merchant/api/v1/domains/:domain_id/themes/purchase Description: Purchase a premium theme for the domain. Initiates payment flow. Path Parameters: - domain_id (required): Domain ID Request Body: { "theme_id": "6799ca2d2accf568166dd6dd", "client_redirect_url": "https://abc.com/callback" } Response: 200 OK { "payment_url": "https://payment-gateway.com/checkout/...", "transaction_id": "txn_123456", "amount": 49.99, "currency": "USD" } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Validate Theme and Get Price GET /api/themes/:theme_id [Theme Service] # Step 3: Create Theme Transaction Record POST /api/theme-transactions [Theme Service] # Step 4: Initiate Payment POST /api/payments/initiate [Payment Service - JUSPAY/Stripe] # Step 5: Return Payment URL -------------------------------------------------------------------------------- API: Update Storefront Theme -------------------------------------------------------------------------------- PUT /merchant/api/v1/domains/:domain_id/themes/:theme_id Description: Update storefront theme configuration, path, status, or active flag. Path Parameters: - domain_id (required): Domain ID - theme_id (required): Storefront theme ID Request Body: { "default_theme_path": "../themes/theme-2", "status": "DRAFT", "is_active": false, "last_published_at": "2024-10-20T12:34:56" } Response: 200 OK { "id": "673f1f862534d01b0cdf203e", "theme_id": "6799ca2d2accf568166dd6dc", "domain_id": "673ed463e1b7500c994a3c33", "default_theme_path": "../themes/theme-2", "status": "DRAFT", "is_active": false } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Update Storefront Theme PUT /api/storefront-themes/:theme_id [Theme Service] # Step 3: If status changed to PUBLISHED, trigger build POST /api/storefront-themes/:id/build [Theme Service] POST /api/cdn/invalidate [CDN Service] -------------------------------------------------------------------------------- API: Update Default Storefront Theme -------------------------------------------------------------------------------- PUT /merchant/api/v1/domains/:domain_id/themes/:theme_id/default Description: Set a specific theme as the default active theme for the domain. Path Parameters: - domain_id (required): Domain ID - theme_id (required): Storefront theme ID to set as default Response: 200 OK { "success": true, "message": "Default theme updated successfully" } OR if already default: { "success": true, "message": "Default theme is already set to this theme" } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Unset current default theme PUT /api/storefront-themes/unset-default?domain_id=:domain_id [Theme Service] # Step 3: Set new default theme PUT /api/storefront-themes/:theme_id/default [Theme Service] # Step 4: Invalidate CDN cache POST /api/cdn/invalidate [CDN Service] -------------------------------------------------------------------------------- API: Delete Storefront Theme -------------------------------------------------------------------------------- DELETE /merchant/api/v1/domains/:domain_id/themes/:theme_id Description: Remove a storefront theme from the domain. Path Parameters: - domain_id (required): Domain ID - theme_id (required): Storefront theme ID Response: 200 OK { "message": "Theme deleted successfully" } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Check if theme is default (cannot delete default) GET /api/storefront-themes/:theme_id [Theme Service] # Step 3: Delete Storefront Theme DELETE /api/storefront-themes/:theme_id [Theme Service] # Step 4: Clean up theme assets DELETE /api/cdn/assets/:theme_id [CDN Service] ================================================================================ SECTION 3: THEME TRANSACTIONS ================================================================================ -------------------------------------------------------------------------------- API: Get Theme Transaction -------------------------------------------------------------------------------- GET /merchant/api/v1/domains/:domain_id/theme_transactions/:id Description: Get details of a theme purchase transaction. Path Parameters: - domain_id (required): Domain ID - id (required): Transaction ID Response: 200 OK { "id": "txn_123456", "domain_id": "673ed463e1b7500c994a3c33", "theme_id": "6799ca2d2accf568166dd6dd", "amount": 49.99, "currency": "USD", "status": "COMPLETED", "payment_channel": "JUSPAY", "payment_id": "pay_xyz123", "created_at": "2024-10-20T12:34:56Z", "completed_at": "2024-10-20T12:35:00Z" } Flow Sequence: # Step 1: Validate Token and Domain Access POST /api/auth/token/verify [User Service] GET /api/domains/:domain_id [Account Service] # Step 2: Fetch Transaction GET /api/theme-transactions/:id [Theme Service] # Step 3: Fetch Payment Details GET /api/payments/:payment_id [Payment Service] ================================================================================ THEME STATUSES ================================================================================ DRAFT - Theme is being configured, not visible to customers PUBLISHED - Theme is live and visible to customers ARCHIVED - Theme is no longer in use but preserved ================================================================================ SUBSCRIPTION LEVELS ================================================================================ FREE - Available to all subscription tiers STARTER - Requires Starter subscription or higher PROFESSIONAL - Requires Professional subscription or higher ENTERPRISE - Requires Enterprise subscription ================================================================================ NOTES ================================================================================ 1. Master themes are global templates; storefront themes are domain instances 2. Only one theme can be the default at a time per domain 3. Premium themes require purchase via payment gateway 4. Theme builds trigger CDN invalidation for asset refresh 5. Theme customization settings stored per-domain 6. Theme features: Mega Menu, Infinite Scroll, Quick Commerce support 7. Themes have usage counters for popularity tracking