Skip to content

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

Open
Priyanshubhartistm wants to merge 2 commits into
cameri:mainfrom
Priyanshubhartistm:feat/subscription-client-status
Open

Priyanshubhartistm wants to merge 2 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: 0aa7c8c

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.

Summary

Adds subscription plans to NIP-11 and a public endpoint for checking a pubkey’s subscription.

  • NIP-11 lists subscription plans and flags restricted writes.
  • Clients can check a pubkey’s subscription and access dates.

Reviews (2) · Last reviewed commit: "fix(payments): report the real end of ac..." · Reviewed by Greptile

Comment thread src/controllers/subscriptions/get-subscription-status-controller.ts Outdated
Comment thread src/controllers/subscriptions/get-subscription-status-controller.ts Outdated
Comment thread CONFIGURATION.md Outdated
@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 39727008160

Coverage increased (+0.2%) to 73.985%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 2 uncovered changes across 2 files (81 of 83 lines covered, 97.59%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/controllers/subscriptions/get-subscription-status-controller.ts 52 51 98.08%
src/factories/controllers/get-subscription-status-controller-factory.ts 7 6 85.71%
Total (6 files) 83 81 97.59%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 11634
Covered Lines: 9014
Line Coverage: 77.48%
Relevant Branches: 6044
Covered Branches: 4065
Branch Coverage: 67.26%
Branches in Coverage %: Yes
Coverage Strength: 775.01 hits per line

💛 - Coveralls

…e not 32 bytes

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

This branch has not been deployed

No deployments
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

2 participants