βš™οΈ Flow: newMerchantSetup

βš™οΈ Flow: newMerchantSetup

This flow initializes a new merchant after signup. Each step is modular, trackable, and testable.

🧠 Purpose: Trigger merchant onboarding logic from Stripe subscription.

🚦 Trigger: Stripe webhook β†’ /registerMerchant Firebase Function

πŸ”— Flow Steps

  1. πŸ“© Stripe Webhook Triggered
    Hint: Make sure Stripe plan IDs match exactly or this will fail.
  2. πŸ—‚ Firestore Document Created β†’ /merchants/{id}
    Hint: Check Firestore > merchants if dashboard doesn’t load after onboarding.
  3. 🌐 Domain/Subdomain Provisioned
    Hint: If domain isn’t loading, check your registrar API or Cloudflare A record setup.
  4. πŸ€– Corbots Assigned Based on Plan Tier
    Hint: Pro tier assigns Mira and Drix by default. Upgrade = more agents.
  5. πŸ“¦ Product Template Inserted
    Hint: Pre-loads 2–3 test products unless merchant disables during onboarding.
  6. πŸ“¬ Welcome Email Sent
    Hint: Logs available via EmailOctopus or SendGrid (depending on config).
  7. βœ… Merchant redirected to dashboard
    Hint: If this fails, recheck redirect URI config in function response.

πŸ§ͺ Flow Test (Prototype)

Simulate this flow manually (test mode):

*This does not send real emails or charge Stripe. Sandbox only.


🧯 Known Issues

  • Occasionally fails if Stripe metadata doesn’t include merchant email.
  • Corbot assignment fails if Firestore config not initialized first.
  • Welcome email delay (~10s) due to cold function start.