Feature #11567
closedFeature #11348: Integrate stripe subscription module for onboarding companies
Task 8: White-Label Customer Billing Hub with Configurable Tenant Self-Cancellation & Exit Survey Auditing
Description
Background & Business Objective¶
Currently, tenants manage payment methods, billing details, and plan status either by redirecting to Stripe's hosted portal (`billing.stripe.com`) or by contacting administrators. While Stripe's hosted portal handles card security, it:
1. Navigates the customer away from our application, creating a disjointed user experience.
2. Does not capture exit feedback or cancellation reasons when a customer decides to churn.
3. Gives our platform zero policy control over whether self-service cancellation is permitted or restricted to admin approval without manual Stripe merchant dashboard toggling.
This task introduces a dedicated, fully white-labeled Customer Billing & Subscription Hub inside both Evergreen POS (`/settings/billing`) and Connect Super Admin (`/app/tenants/:id/billing`), unifying plan visibility, invoice history, payment updates, and an intelligent in-app cancellation workflow.
Scope & Key Features¶
1. Unified White-Label Billing Hub (Shared UI for Tenant & Super Admin): * Clean overview displaying: * Active plan name, billing interval (monthly/yearly), next renewal date, and renewal amount. * Real-time billing status badge (Active, Past Due, Grace Period, Canceling soon, Suspended). * Card on file summary (Brand icon, last 4 digits, expiration date). * Comprehensive Invoice & Billing History table with direct PDF receipt download.
2. Super-Admin-Controlled Self-Cancellation Policy: * Introduce a platform-level configuration toggle: `allowTenantSelfCancellation` (Boolean). * When Enabled (`true`): Tenant sees an in-app "Cancel Subscription" button. * When Disabled (`false`): Replaces the cancellation button with a courteous "Need to change or cancel your plan? Contact your Account Manager" CTA to prevent unwanted churn and accidental POS shutdowns.
3. In-App Cancellation Modal with Churn Feedback Survey: * If self-cancellation is enabled, clicking "Cancel Subscription" triggers an in-app survey modal: * Reason for leaving (Dropdown: Seasonal business closure, Switched to another provider, Missing features, Pricing/Budget, Other). * Optional comments/feedback textarea. * Effective date selection (Default: End of current billing cycle vs Immediate for admins). * Automatically persists the feedback, cancellation reason, and actor tag into `company.saasBillingActionHistory`. * Sends automated notification to Super Admin with customer exit feedback.
4. Secure Hybrid Payment Method Update: * When updating credit/debit card details, provides a dedicated "Update Card" action that launches a focused Stripe card update session without exposing the generic Stripe cancellation options. * Maintains 100% PCI-DSS compliance with zero cardholder data liability on our servers.
5. In-App Retention & Pause Offer (Optional Churn Reduction): * For seasonal businesses (e.g. landscaping/nurseries in winter), present a "Pause Subscription" or "Seasonal Hold" option before final cancellation confirmation.
Technical Architecture & Endpoints¶
- Backend (`evergreen_pos_be`): * Extend `POST /api/v1/superadmin/billing/cancel` to accept `{ reason, feedback, actor }` and log structured metadata to `saasBillingActionHistory`. * Add `GET /api/v1/superadmin/billing/config` and `PATCH /api/v1/superadmin/billing/config` for `allowTenantSelfCancellation`. * Ensure `tenantBilling.service.js` records the exit survey data.
- Frontend (`evergreen_pos_fe` & `nexZentekSubscription_fe`): * `CustomerBillingHub.tsx`: Reusable subscription and billing overview card. * `CancelSubscriptionModal.tsx`: Churn feedback survey modal.
Business Value & Acceptance Criteria¶
- Brand Consistency: 100% white-labeled experience keeping tenants inside the Evergreen platform.
- Churn Insights: Every cancellation records rich feedback explaining why the customer left.
- Operational Safety: Prevents accidental store shutdowns by allowing Super Admins to govern cancellation policies.
- Audit Compliance: All actions (who cancelled, why, and when) are queryable in the tenant's billing audit timeline.
Subtasks
Related issues
Updated by Divya Inapakurthi 3 days ago
- Target version set to sprint (10/12/2026 - 10/31/2026)
Updated by Divya Inapakurthi about 20 hours ago
- Status changed from New to In Progress
Updated by Divya Inapakurthi about 20 hours ago
- Due date set to 10/21/2026
- Start date changed from 10/16/2026 to 10/21/2026
Updated by Divya Inapakurthi about 15 hours ago
- Centralize default grace period and self-cancellation policy into Platform BillingSettings (remove legacy company-specific grace override)
- Enforce central allowTenantSelfCancellation setting strictly across tenant summary and cancellation endpoints
- Support customer portal session creation for Stripe payment method updates (flow: 'payment_method_update')
- Enhance cancelTenantSubscription to record churn reason, exit feedback, and actor in saasBillingActionHistory
- Add updateTenantBillingContact to sync billing contact & tax address with Stripe while isolating operational company details
- Fix Stripe webhook in-memory status mutation bug (prevents duplicate trialing-to-trialing event logs)
- Integrate createCustomerPortalSession to launch Stripe payment method update portal securely
- Add subscription cancellation survey modal with churn reason dropdown and comments/feedback textarea
- Strictly enforce central allowTenantSelfCancellation policy (hide cancel button and display support contact info when blocked)
- Clean up duplicate Update Card buttons in PlanUsagePage
- Add 403 suspension interceptor and account status notice check on login
- Add dedicated Platform Billing Settings page (/app/billing-settings) for central self-cancellation, grace days, and support contact management
- Remove obsolete per-tenant self-cancellation override tile from CompanyDetailsPage for a clean 3-column Billing Hub
- Remove redundant Stripe Portal and duplicate Resume buttons, preserving single contextual resume action in cancellation banner
- Resolve banner collision by hiding Free Trial banner when subscription is scheduled to cancel
- Remove duplicate Add Payment Method button from trial banner in favor of header Update Card action
- Add Free Trial status badges, remaining days countdown, and trial expiration details to CompanyDetailsPage
Updated by Divya Inapakurthi about 14 hours ago
- Status changed from In Progress to Closed