βοΈ 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
- π© Stripe Webhook Triggered
Hint: Make sure Stripe plan IDs match exactly or this will fail. - π Firestore Document Created β /merchants/{id}
Hint: Check Firestore > merchants if dashboard doesn’t load after onboarding. - π Domain/Subdomain Provisioned
Hint: If domain isn’t loading, check your registrar API or Cloudflare A record setup. - π€ Corbots Assigned Based on Plan Tier
Hint: Pro tier assigns Mira and Drix by default. Upgrade = more agents. - π¦ Product Template Inserted
Hint: Pre-loads 2β3 test products unless merchant disables during onboarding. - π¬ Welcome Email Sent
Hint: Logs available via EmailOctopus or SendGrid (depending on config). - β
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.