Skip to content

Implement subscription usage-based billing with real-time metering #203

@Smartdevs17

Description

@Smartdevs17

Implement subscription usage-based billing with real-time metering

Description

Context: Usage-based subscriptions require real-time usage tracking and billing.

Current Limitation: No real-time usage metering exists.

Expected Outcome: Implement usage metering system with real-time tracking and billing.

Acceptance Criteria

  • Implement MeteredUsage: metric, value, timestamp
  • Add real-time meter data ingestion
  • Implement usage aggregation by period
  • Add real-time billing calculation
  • Support multiple meters per subscription
  • Implement usage alerts and notifications
  • Add usage history and trends
  • Create React Native usage monitoring UI

Technical Scope

Files Likely Affected:

  • contracts/metering/src/lib.rs - New metering module
  • app/stores/meteringStore.ts - Metering state
  • app/screens/UsageMonitoringScreen.tsx

APIs/Contracts Involved:

  • record_metered_usage(subscription_id: SubscriptionId, meter: Meter, value: u64)
  • calculate_usage_charge(subscription_id: SubscriptionId, period: TimeRange) -> Charge

Edge Cases to Consider:

  • High-frequency metering
  • Meter data consistency

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or requestfeatureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions