Skip to content

feat(payments): let clients see their subscription tier - #926

Merged
cameri merged 6 commits into
cameri:mainfrom
Priyanshubhartistm:feat/subscription-client-status
Oct 28, 2026
Merged

cameri merged 6 commits into
cameri:mainfrom
Priyanshubhartistm:feat/subscription-client-status

Conversation

@Priyanshubhartistm

Copy link
Copy Markdown
Collaborator

Description

Builds on the subscription lifecycle (#909). Nothing changes unless payments.enabled is true and payments.subscriptionPlans is non-empty.

  • NIP-11: the plans are advertised under fees.subscription, one entry per plan with amount in msats, unit, and period in seconds (the standard NIP-11 shape), plus id, which is what a client sends as planId to POST /invoices, and description when the plan has one. limitation.restricted_writes is now true when plans are in use, since a subscription is what lets a pubkey write even without an admission fee.
  • GET /subscriptions/status?pubkey=<hex or npub> returns the pubkey's planId, status, active, currentPeriodEnd and accessEndsAt (ISO dates, null when it never ends). active is judged from the dates, as the write gate does, so grace counts and a lapsed subscription the sweep has not reached yet does not. A pubkey with no subscription gets nulls and active: false. It answers 400 for an invalid pubkey and 404 while plans are off, and is counted against limits.invoice.rateLimits under its own key.
  • CONFIGURATION.md describes both.

Related Issue

Closes #925

Motivation and Context

The endpoint is public, like /admissions/check/:pubkey, and only reports what the relay already enforces for that pubkey.

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9233875

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

The PR lets clients discover subscription plans and check a pubkey's subscription.

  • NIP-11 lists configured subscription plans alongside existing fees.
  • Clients can look up a pubkey’s subscription status and access dates.

Reviews (5) · Last reviewed commit: "Merge branch 'main' into feat/subscripti..." · Reviewed by Greptile

Comment thread CONFIGURATION.md Resolved
@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 40761863761

Warning

No base build found for commit 3b35377 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 76.545%

Details

  • Patch coverage: 2 uncovered changes across 2 files (82 of 84 lines covered, 97.62%).

Uncovered Changes

File Changed Covered %
src/controllers/subscriptions/get-subscription-status-controller.ts 53 52 98.11%
src/factories/controllers/get-subscription-status-controller-factory.ts 7 6 85.71%
Total (6 files) 84 82 97.62%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 11659
Covered Lines: 9329
Line Coverage: 80.02%
Relevant Branches: 6030
Covered Branches: 4211
Branch Coverage: 69.83%
Branches in Coverage %: Yes
Coverage Strength: 782.31 hits per line

💛 - Coveralls

…e not 32 bytes

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
greptile-apps[bot]
greptile-apps Bot previously approved these changes Oct 22, 2026
@cameri

cameri commented Oct 23, 2026

Copy link
Copy Markdown
Owner

@Priyanshubhartistm Let's please fix the issue flagged by Greptile

@greptile-apps
greptile-apps Bot dismissed their stale review October 28, 2026 20:16

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@cameri
cameri merged commit 2819e30 into cameri:main Oct 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(payments): let clients see their subscription tier

3 participants