Overview
Add a subscription invoice variant where a creator defines a billing interval and the contract automatically opens a new invoice each cycle. Payers opt-in once and are billed per cycle until they cancel.
Acceptance Criteria
- New
InvoiceType::Subscription { interval_ledgers: u32, max_cycles: Option<u32> } variant in types.rs
create_subscription(params) entry point creates the first invoice and registers the subscription
advance_cycle(subscription_id) opens the next invoice when the previous cycle closes
cancel_subscription(subscription_id, caller) stops future cycles; caller must be the payer or creator
- Contract enforces that only opted-in payers can pay a subscription invoice
- Events emitted:
subscription_created, cycle_advanced, subscription_cancelled
Overview
Add a subscription invoice variant where a creator defines a billing interval and the contract automatically opens a new invoice each cycle. Payers opt-in once and are billed per cycle until they cancel.
Acceptance Criteria
InvoiceType::Subscription { interval_ledgers: u32, max_cycles: Option<u32> }variant intypes.rscreate_subscription(params)entry point creates the first invoice and registers the subscriptionadvance_cycle(subscription_id)opens the next invoice when the previous cycle closescancel_subscription(subscription_id, caller)stops future cycles; caller must be the payer or creatorsubscription_created,cycle_advanced,subscription_cancelled