Skip to content

feat: zero-cost payment gate and balance-based rate limits #244

Description

@melvincarvalho

Summary

Two related enhancements to the payment system:

1. Zero-cost PaymentCondition (membership gate)

A PaymentCondition with "amount": "0" should grant access if the user has a balance — without deducting anything. This acts as a membership check: "prove you have funds."

Currently amount: 0 skips the balance check and always returns 402. Fix: check that a balance entry exists and grant access.

{
  "acl:condition": {
    "@type": "PaymentCondition",
    "amount": "0",
    "currency": "sats"
  }
}

2. Balance-based rate limits

Users with a balance get relaxed rate limits. Spammers won't deposit real sats to abuse the API.

  • No balance — default rate limits (strict)
  • Has balance — relaxed (e.g. 2x)
  • Higher balance — more relaxed (e.g. 10x)

This makes the payment system double as an anti-spam / trust layer.

Design question

For the zero-cost gate: should balance >= 0 (has an account) or balance > 0 (has actual funds) be the requirement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions