ChainSafe / ChainSafe/open-creator-rails

Subscriber-side subscription management — view, cancel, and renew active subscriptions

Open
#101 2 comments 0 reactions 1 assignee Claimed by @dhyaniarun1993 View on GitHub
Dominant language
Solidity
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## What

The SDK and indexer API need to expose subscriber-side operations — querying active subscriptions by identity, and write operations for cancellation and renewal — so integrators can build subscriber account management without direct contract or indexer coupling.

## Why

After purchasing a subscription, a player has no SDK-level way to list what they're subscribed to, check expiry, cancel, or renew. This is a standard requirement for any subscription product and must be part of the SDK surface.

## Required SDK surface

```ts
// Query
getActiveSubscriptions(subjectId: string): Promise

interface Subscription {
assetAddress: string
assetName?: string
expiresAt: number // unix timestamp
isActive: boolean
}

// Writes
cancelSubscription(assetAddress: string, subjectId: string): Promise
renewSubscription(assetAddress: string, subjectId: string, plan: SubscriptionPlan): Promise
```

## Required indexer queries

- Active subscriptions by subject identity (bytes32)
- Subscription history by subject identity

## Notes

- `subjectId` must use the bytes32 subject identity model (not raw wallet address) per the existing subscriber model
- `cancelSubscription` should trigger the reimbursement flow for unused time (per existing contract logic)
- `renewSubscription` should reuse the same plan resolution as `subscribe` (#98)

## Acceptance Criteria

- [ ] `getActiveSubscriptions(subjectId)` returns all active subscriptions from indexer
- [ ] Each subscription includes expiry timestamp and asset reference
- [ ] `cancelSubscription` triggers partial refund for unused time
- [ ] `renewSubscription` extends access using correct plan + payment
- [ ] All methods documented with usage examples

## Dependencies

- WP6 — subject-wallet linkage (subjectId resolution)
- WP2 — indexer must support subscription queries by subject identity
- #98 — renew reuses plan selection surface

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.