{"uid":"cap_aOXAAPJ3opAZGmLs-BUtH","slug":"saas-subscription-proration-audit-d7497e1a","name":"SaaS Subscription Proration Audit","description":"Public static preview plus paid token controls, risk consensus, AI security, webhook reliability, developer security, schedule risk, decision analysis, API release compatibility, accounts-payable reconciliation, e-commerce return eligibility, SaaS subscription-proration, sales-commission reconciliation, parcel-charge reconciliation, SLA service-credit reconciliation, advertising spend-and-fee audit, contract-renewal audit, workforce timecard reconciliation, hotel booking-commission reconciliation, and warehouse cycle-count adjustment reconciliation products for autonomous agents.","url":"https://rooke-token-risk-pilot.rookepoole.workers.dev/v1/x402/subscription-proration-audit?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"policy":{"type":"object","required":["toleranceMinor"],"properties":{"toleranceMinor":{"type":"integer","maximum":1000000,"minimum":0}},"additionalProperties":false},"invoice":{"type":"object","required":["invoiceId","observedCreditMinor","observedChargeMinor","observedNetMinor"],"properties":{"invoiceId":{"type":"string","maxLength":120,"minLength":1},"observedNetMinor":{"type":"integer","maximum":9007199254740991,"minimum":-9007199254740991},"observedChargeMinor":{"type":"integer","maximum":9007199254740991,"minimum":0},"observedCreditMinor":{"type":"integer","maximum":9007199254740991,"minimum":0}},"additionalProperties":false},"subscription":{"type":"object","required":["subscriptionId","currency","billingPeriodStart","billingPeriodEnd","changeEffectiveAt","latestInvoicePaid","prorationBehavior","beforeItems","afterItems"],"properties":{"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"afterItems":{"type":"array","items":{"type":"object","required":["subscriptionItemId","priceId","quantity","prorationUnitAmountMinor"],"properties":{"priceId":{"type":"string","maxLength":120,"minLength":1},"quantity":{"type":"integer","maximum":1000000,"minimum":0},"subscriptionItemId":{"type":"string","maxLength":120,"minLength":1},"prorationUnitAmountMinor":{"type":"integer","maximum":9007199254740991,"minimum":0}},"additionalProperties":false},"maxItems":200},"beforeItems":{"type":"array","items":{"type":"object","required":["subscriptionItemId","priceId","quantity","prorationUnitAmountMinor"],"properties":{"priceId":{"type":"string","maxLength":120,"minLength":1},"quantity":{"type":"integer","maximum":1000000,"minimum":0},"subscriptionItemId":{"type":"string","maxLength":120,"minLength":1},"prorationUnitAmountMinor":{"type":"integer","maximum":9007199254740991,"minimum":0}},"additionalProperties":false},"maxItems":200},"subscriptionId":{"type":"string","maxLength":120,"minLength":1},"billingPeriodEnd":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"},"changeEffectiveAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"},"latestInvoicePaid":{"type":"boolean"},"prorationBehavior":{"enum":["CREATE_PRORATIONS","ALWAYS_INVOICE","NONE"],"type":"string"},"billingPeriodStart":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"}},"additionalProperties":false}}},"responseSchema":{"type":"json","example":{"timing":{"periodMilliseconds":2678400000,"remainingMilliseconds":1382400000},"summary":{"toleranceMinor":1,"changedItemCount":1,"latestInvoicePaid":true,"unchangedItemCount":0},"verdict":"MATCHED_WITHIN_TOLERANCE","currency":"USD","expected":{"netMinor":5162,"chargeMinor":10323,"creditMinor":5161},"observed":{"netMinor":5162,"chargeMinor":10323,"creditMinor":5161},"invoiceId":"in_42","riskFlags":[],"variances":{"netMinor":0,"chargeMinor":0,"creditMinor":0,"observedArithmeticMinor":0},"reportHash":"sha256-hex","evidenceGaps":["CALLER_SUPPLIED_SUBSCRIPTION_AND_INVOICE_FACTS_NOT_AUTHENTICATED"],"claimBoundary":{"chargeAttempted":false,"invoiceModified":false,"billingPlatformStateVerified":false},"schemaVersion":"SUBSCRIPTION_PRORATION_AUDIT_V1","subscriptionId":"sub_42","calculatedLines":[],"prorationBehavior":"CREATE_PRORATIONS","requestCommitment":"sha256-hex","calculatedIfEnabled":{"netMinor":5162,"chargeMinor":10323,"creditMinor":5161},"recommendedDisposition":"MATCHED_NO_ACTION"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"9","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$9/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"9","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"9","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_biHpzD8Q8nza83VJbsaOl","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"9","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Verifies that a SaaS subscription mid-cycle proration invoice matches the mathematically expected credits and charges given the before/after plan items and timing.","exampleAgentPrompt":"Can you audit the proration on invoice in_42 for subscription sub_42? The billing period is 2024-03-01 to 2024-03-31, the plan change took effect on 2024-03-17, the before item was price_basic at qty 1 for 10000 minor units and the after item is price_pro at qty 1 for 20000 minor units, proration behavior is CREATE_PRORATIONS, the invoice shows a charge of 10323 and a credit of 5161, and I want to allow a tolerance of 1 minor unit.","exampleUseCases":[{"title":"Mid-cycle seat upgrade charge check","prompt":"We upgraded a customer from 5 seats to 10 seats on March 15th mid-billing-period. The invoice shows a charge of $103.23 and credit of $51.61 — can you verify the proration math is correct? Subscription is sub_upgrade_99, billing period March 1–31, proration behavior CREATE_PRORATIONS, tolerance 2 cents."},{"title":"Downgrade credit reconciliation","prompt":"A customer downgraded their plan on the 20th of the month and we issued a proration credit on invoice in_credit_77. The subscription sub_down_77 ran from July 1 to July 31, and the credit observed was $28.40 with no new charge. Can you audit whether that credit amount is right given the before and after plan items?"},{"title":"Automated billing anomaly detection","prompt":"Every time we process a subscription change, I want to automatically check whether the resulting proration invoice matches what we expect. For subscription sub_auto_55, billing period 2024-05-01 to 2024-05-31, change on 2024-05-10, before item was price_starter qty 3 at 5000 minor units, after item is price_growth qty 3 at 8000 minor units, CREATE_PRORATIONS, observed charge 13548 and credit 4516, tolerance 5 minor units — is this correct?"}],"resultDescription":"Returns a structured audit report with a verdict (e.g. MATCHED_WITHIN_TOLERANCE or a mismatch code), the expected vs. observed charge, credit, and net amounts in minor currency units, item-level variances, any risk flags, evidence gaps (such as unverified caller-supplied facts), claim boundary flags, individual calculated proration lines, a recommended disposition, and a SHA-256 report hash for audit trail purposes.","failureModes":["Invalid or missing required fields (subscriptionId, billingPeriodStart, billingPeriodEnd, etc.) return a 400 validation error","Currency code not matching ISO 4217 three-letter format causes rejection","billingPeriodEnd before billingPeriodStart causes a logic error","More than 200 before or after items triggers a schema violation","Payment of $9 USDC via x402 required — missing or failed payment returns 402","Caller-supplied facts are not independently verified, so CALLER_SUPPLIED_SUBSCRIPTION_AND_INVOICE_FACTS_NOT_AUTHENTICATED evidence gap is always present"],"whenToPreferThis":"Choose this endpoint when you need a deterministic, math-grounded audit of a SaaS subscription proration invoice — especially for mid-cycle plan upgrades, downgrades, or quantity changes — and want a structured verdict with variance breakdown, risk flags, and a tamper-evident report hash. Prefer this over manual calculation or generic reconciliation tools when you need per-item proration line visibility and a machine-readable recommended disposition suitable for autonomous finance workflows.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T06:43:11.242Z","isFirstParty":false,"canonicalSlug":"saas-subscription-proration-audit-d7497e1a"}