{"lexicon":1,"id":"money.atmosphere.payment.listSubscriptionInvoices","defs":{"main":{"type":"query","description":"Read settled native recurring invoice occurrences for a known checkout payment owned by the authenticated originating app. Requires registered-app service-auth with this exact method. Currently test-only. Supply invoiceId for one exact occurrence, or drain cursor pages and periodically restart from the beginning to recover missed notifications. Payment id is the original checkout anchor and may repeat across invoices; occurrenceId and invoiceId identify each paid period. Original checkout completion never proves a renewal. Invoice history is not current access authority. currentTerms identifies the effective membership at revision in the same fenced read as accessAllowed and accessValidUntil. Callers must recheck before granting access and apply effects once per occurrence. Responses are private and no-store. No processor command, new payment or event publication is performed.","parameters":{"type":"params","required":["paymentId"],"properties":{"paymentId":{"type":"string","maxLength":256},"environment":{"type":"string","knownValues":["test"],"default":"test"},"invoiceId":{"type":"string","maxLength":256},"cursor":{"type":"string","maxLength":256,"description":"Invoice-id page position, never a completeness watermark. Mutually exclusive with invoiceId."},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["paymentId","subscriptionId","environment","status","revision","accessAllowed","invoices"],"properties":{"paymentId":{"type":"string"},"subscriptionId":{"type":"string"},"environment":{"type":"string","knownValues":["test"]},"status":{"type":"string","description":"Current relationship status; cancellation uses US canceled."},"revision":{"type":"integer","minimum":1,"description":"Relationship revision, not a watermark for complete invoice history."},"paidThrough":{"type":"string","format":"datetime"},"currentPeriodEnd":{"type":"string","format":"datetime"},"cancelAtPeriodEnd":{"type":"boolean","description":"The processor will end the subscription at the end of the current period."},"cancelAt":{"type":"string","format":"datetime","description":"The processor's scheduled cancellation instant, when one is set."},"accessAllowed":{"type":"boolean"},"currentTerms":{"type":"ref","ref":"#currentTerms","description":"Effective membership terms at this relationship revision, independent of the requested invoice/page. Present after exact membership terms take effect; absent before then and for non-membership subscriptions. A paid tier change replaces them; replay does not. Cancellation, full join refund and expiry retain the binding but accessAllowed/accessValidUntil alone determine access. Never infer current terms from invoice order or require an invoice revision to equal this revision. Missing or invalid membership terms refuse the read."},"accessValidUntil":{"type":"string","format":"datetime","description":"Present exactly when accessAllowed is true: the instant to which accessAllowed holds unless ATM learns something new (a renewal extends it; a refund, dispute or cancellation can end access earlier), past-due grace included. Never later than the instant access actually ends. Recheck before relying on access beyond a short cache."},"cursor":{"type":"string"},"invoices":{"type":"array","maxLength":50,"items":{"type":"ref","ref":"#invoice"}}}}},"errors":[{"name":"SubscriptionInvoicesNotFound","description":"Unknown checkout/invoice or not owned by this app in test."},{"name":"SubscriptionInvoicesUnavailable","description":"Current authoritative state cannot be read. Retry without inventing a paid period."}]},"invoice":{"type":"object","required":["invoiceId","occurrenceId","paymentId","firstInvoice","amountPaid","currency","originalSuccessAt","periodStart","periodEnd","amountRefunded","refundPending","disputed"],"nullable":["changeId","relationshipRevision"],"description":"Historical purchased terms, never current access authority. Every native membership invoice includes recurringAmount, termsId, changeId (null initially), relationshipRevision, program, tier, product, price and cadence; incomplete membership terms refuse the read. Other subscriptions omit these terms fields.","properties":{"invoiceId":{"type":"string"},"occurrenceId":{"type":"string"},"paymentId":{"type":"string"},"firstInvoice":{"type":"boolean"},"amountPaid":{"type":"integer","minimum":0},"currency":{"type":"string"},"originalSuccessAt":{"type":"string","format":"datetime"},"periodStart":{"type":"string","format":"datetime"},"periodEnd":{"type":"string","format":"datetime"},"amountRefunded":{"type":"integer","minimum":0},"refundPending":{"type":"boolean"},"disputed":{"type":"boolean"},"recurringAmount":{"type":"integer","minimum":1,"description":"Recurring principal in currency minor units, before invoice discounts or proration."},"termsId":{"type":"string"},"changeId":{"type":"string","description":"The applied tier change; null for initial membership terms."},"program":{"type":"ref","ref":"com.atproto.repo.strongRef"},"tier":{"type":"ref","ref":"com.atproto.repo.strongRef"},"product":{"type":"ref","ref":"com.atproto.repo.strongRef"},"price":{"type":"ref","ref":"com.atproto.repo.strongRef"},"cadence":{"type":"ref","ref":"#cadence"},"relationshipRevision":{"type":"integer","minimum":1,"description":"Relationship revision retained with this invoice's terms, which may precede the current revision. Null when the invoice source did not capture one (including the initial signup); never fabricated from today's revision."}}},"currentTerms":{"type":"object","required":["recurringAmount","termsId","changeId","program","tier","product","price","cadence","effectiveInvoiceId","effectiveOccurrenceId"],"nullable":["changeId"],"properties":{"recurringAmount":{"type":"integer","minimum":1,"description":"Recurring principal in currency minor units, before invoice discounts or proration."},"termsId":{"type":"string"},"changeId":{"type":"string","description":"The applied tier change; null for initial membership terms."},"program":{"type":"ref","ref":"com.atproto.repo.strongRef"},"tier":{"type":"ref","ref":"com.atproto.repo.strongRef"},"product":{"type":"ref","ref":"com.atproto.repo.strongRef"},"price":{"type":"ref","ref":"com.atproto.repo.strongRef"},"cadence":{"type":"ref","ref":"#cadence"},"effectiveInvoiceId":{"type":"string","description":"Exact settled invoice that first made these terms effective, retained across subsequent renewals."},"effectiveOccurrenceId":{"type":"string","description":"Settlement occurrence of effectiveInvoiceId."}}},"cadence":{"type":"object","required":["interval","intervalCount"],"properties":{"interval":{"type":"string","knownValues":["month","year"]},"intervalCount":{"type":"integer","const":1}}}}}