{"lexicon":1,"id":"money.atmosphere.analytics.getRefundAnalysis","defs":{"reasonStat":{"type":"object","required":["reasonCode","status","currency","count","amountCents"],"properties":{"reasonCode":{"type":"string","maxLength":32,"description":"Refund reason code, or 'unspecified'."},"status":{"type":"string","maxLength":24},"currency":{"type":"string","maxLength":3},"count":{"type":"integer"},"amountCents":{"type":"integer"}}},"currencySummary":{"type":"object","required":["currency","refundCount","refundedCents","settledCount","settledGrossCents"],"properties":{"currency":{"type":"string","maxLength":3},"refundCount":{"type":"integer"},"refundedCents":{"type":"integer"},"settledCount":{"type":"integer","description":"Settled payments in window — denominator for refund rate."},"settledGrossCents":{"type":"integer"}}},"main":{"type":"query","description":"Refund analysis for the calling app, scoped to its own originated payments. Groups refunds by reason code + status per currency; the summary carries settled gross per currency so a refund rate can be computed without summing across currencies. Aggregates only — no buyer PII or per-payment rows.","parameters":{"type":"params","properties":{"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"windowDays":{"type":"integer","minimum":1,"maximum":92,"default":30},"currency":{"type":"string","maxLength":3}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["byReason","summary","window"],"properties":{"byReason":{"type":"array","items":{"type":"ref","ref":"#reasonStat"}},"summary":{"type":"array","items":{"type":"ref","ref":"#currencySummary"}},"window":{"type":"object","required":["windowDays","from","to"],"properties":{"windowDays":{"type":"integer"},"from":{"type":"string","format":"datetime"},"to":{"type":"string","format":"datetime"}}}}}}}}}