Skip to content

Implement subscription credit system and account balance #196

@Smartdevs17

Description

@Smartdevs17

Implement subscription credit system and account balance

Description

Context: Subscribers may have account credits from refunds, promotions, or overpayments that should apply to future charges.

Current Limitation: No credit balance system exists.

Expected Outcome: Implement credit system with balance tracking and automatic application.

Acceptance Criteria

  • Implement AccountCredit: balance, transactions[], expiration_policy
  • Add credit issuance (manual and automatic)
  • Implement automatic credit application on charging
  • Support credit transfer between accounts
  • Add credit expiration handling
  • Implement credit transaction history
  • Create React Native credit management UI
  • Write tests for credit operations

Technical Scope

Files Likely Affected:

  • contracts/credit/src/lib.rs - New credit module
  • app/stores/creditStore.ts - Credit state
  • app/screens/CreditBalanceScreen.tsx

APIs/Contracts Involved:

  • issue_credit(subscriber: Address, amount: i128, reason: String)
  • apply_credit(subscription_id: SubscriptionId) -> CreditApplied
  • get_credit_balance(subscriber: Address) -> i128

Edge Cases to Consider:

  • Credit expiration
  • Negative balance

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