{"lexicon":1,"id":"money.atmosphere.app.auditFeeDistributions","defs":{"distribution":{"type":"object","required":["id","paymentId","role","amountCents","currency","status","clawbackAmountCents","createdAt"],"properties":{"id":{"type":"string","maxLength":128,"description":"Distribution row id."},"paymentId":{"type":"string","maxLength":128,"description":"The originating payment id (the app-visible payment id)."},"chargeId":{"type":"string","maxLength":256,"description":"Processor charge/invoice id this distribution settled against. For subscription renewals this is the per-cycle invoice id, so one subscription produces one distribution per cycle."},"role":{"type":"string","maxLength":32,"description":"Distribution role. For this endpoint the caller always sees its own app-fee share (role 'app')."},"amountCents":{"type":"integer","description":"Gross app-fee amount for this distribution, in the smallest currency unit."},"currency":{"type":"string","maxLength":3,"description":"Lowercase ISO 4217. Never sum amounts across differing currencies."},"status":{"type":"string","knownValues":["queued","scheduled","transferred","held","reversed","failed"],"maxLength":16,"description":"Synthesized payout status. queued = awaiting transfer; scheduled = deferred under a payout schedule until heldUntil; held = transfer paused due to a problem (see heldReason); transferred = paid out; reversed = fully reversed; failed = transfer failed."},"heldReason":{"type":"string","maxLength":512,"description":"Operator-authored reason a queued transfer is held (only set when status = held)."},"heldUntil":{"type":"string","format":"datetime","description":"Scheduled payout time. Set only when status = scheduled (the app-fee row is deferred under a payout schedule); the transfer runs on or after this time."},"processorTransferId":{"type":"string","maxLength":256,"description":"Rail-agnostic processor transfer id for the payout movement (e.g. a Stripe transfer id). Never the recipient connected-account id."},"clawbackStatus":{"type":"string","knownValues":["pending","reversed","failed","waived"],"maxLength":16,"description":"Partial-refund clawback state of an already-transferred app share. Absent when no clawback applies. Net earned = amountCents - clawbackAmountCents when clawback is reversed."},"clawbackAmountCents":{"type":"integer","description":"Amount of this app-fee share clawed back by a partial refund, in the smallest currency unit. 0 when none."},"processorReversalId":{"type":"string","maxLength":256,"description":"Rail-agnostic processor reversal id for the clawback/reversal movement."},"period":{"type":"string","maxLength":16,"description":"Optional operator grouping period."},"createdAt":{"type":"string","format":"datetime"}}},"main":{"type":"query","description":"Audit the calling app's own app-fee payout distributions for payout transparency and reconciliation. Requires a service-auth JWT signed by the app DID; returns ONLY rows the app both originated and is the fee recipient of. Creator/recipient settlement is out of scope (direct charges are never in this table). Free core read over the app-fee rail; carries no buyer PII, payer fields, or connected-account ids.","parameters":{"type":"params","properties":{"cursor":{"type":"string","maxLength":128,"description":"Opaque keyset cursor from a prior page. Omit to start at the most recent distribution."},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8,"description":"Which app environment's payouts to return. Defaults to live."},"paymentId":{"type":"string","maxLength":128,"description":"Optional filter to a single originating payment."},"status":{"type":"string","knownValues":["queued","scheduled","transferred","held","reversed","failed"],"maxLength":16,"description":"Optional filter to one synthesized payout status."},"limit":{"type":"integer","minimum":1,"maximum":200,"default":50}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["distributions"],"properties":{"distributions":{"type":"array","items":{"type":"ref","ref":"#distribution"}},"cursor":{"type":"string","maxLength":128,"description":"Keyset cursor for the next page; absent when no more rows."}}}}}}}