{"lexicon":1,"id":"money.atmosphere.payment.cancelSubscription","defs":{"main":{"type":"procedure","description":"Cancel a subscription on behalf of the authenticated payer. Requires a service-auth JWT signed by the payer DID; the JWT iss must match the subscription's payerDid or claimedPayerDid. Pass exactly one of subscriptionId or paymentId; subscriptionId is preferred.","input":{"encoding":"application/json","schema":{"type":"object","properties":{"subscriptionId":{"type":"string","maxLength":256,"description":"Opaque ATM subscription relationship id from money.atmosphere.payment.listSubscriptions. Preferred for cross-app subscription management."},"paymentId":{"type":"string","maxLength":256,"description":"Legacy/current ATM recurring payment id. Use subscriptionId when available because replacement payment rows can change over time."},"reason":{"type":"string","maxLength":256}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["paymentId","status","canceledAt"],"properties":{"subscriptionId":{"type":"string","maxLength":256},"paymentId":{"type":"string","maxLength":256},"status":{"type":"string","maxLength":64},"canceledAt":{"type":"string","format":"datetime"}}}},"errors":[{"name":"InvalidRequest","description":"Exactly one of subscriptionId or paymentId is required."},{"name":"PaymentNotFound","description":"Subscription payment not found for this payer."},{"name":"NotASubscription","description":"Payment is not a subscription."},{"name":"SubscriptionSuperseded","description":"This subscription record was replaced by a newer subscription change."},{"name":"RecipientProcessorAccountMissing","description":"Recipient has no connected processor account."},{"name":"ProcessorCancelFailed","description":"The processor cancellation call failed."},{"name":"SubscriptionCancelFailed","description":"The subscription could not be canceled."}]}}}