{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/methodfi/main/json-schema/methodfi-payment-reversal-response-schema.json", "title": "PaymentReversalResponse", "x-generated": "2026-10-12", "x-method": "derived", "x-generator": "derive-json-schema.py", "x-source": "openapi/methodfi-payment-reversals-api-openapi.yml#/components/schemas/PaymentReversalResponse", "allOf": [ { "$ref": "#/$defs/SuccessEnvelope" }, { "type": "object", "properties": { "data": { "$ref": "#/$defs/PaymentReversal" } } } ], "$defs": { "PaymentReversal": { "type": "object", "description": "A reversal for a payment, representing a return of funds.", "required": [ "id", "pmt_id", "status", "direction", "trace_id", "target_account", "amount", "description", "fee", "created_at", "updated_at" ], "properties": { "id": { "type": "string", "description": "Unique identifier for the reversal.", "pattern": "^rvs_\\w+$" }, "pmt_id": { "type": "string", "description": "Identifier of the payment being reversed.", "pattern": "^pmt_\\w+$" }, "status": { "type": "string", "description": "Current status of the reversal.", "enum": [ "pending_approval", "pending", "processing", "failed", "sent", "pending_settlement" ] }, "direction": { "type": "string", "description": "Direction of the reversal relative to the original payment.", "enum": [ "credit", "debit" ] }, "trace_id": { "type": [ "string", "null" ], "description": "Trace identifier for the reversal." }, "target_account": { "type": [ "string", "null" ], "description": "The target account for the reversal." }, "amount": { "type": "integer", "description": "Reversal amount in cents.", "minimum": 0 }, "description": { "type": [ "string", "null" ], "description": "Human-readable description for the reversal." }, "fee": { "type": [ "object", "null" ], "description": "Fee information for the reversal." }, "error": { "$ref": "#/$defs/PaymentReversalResourceError" }, "created_at": { "type": "string", "format": "date-time", "description": "Timestamp when the reversal was created." }, "updated_at": { "type": "string", "format": "date-time", "description": "Timestamp when the reversal was last updated." } } }, "PaymentReversalResourceError": { "type": [ "object", "null" ], "description": "Error details when a payment reversal fails.", "required": [ "type", "code", "sub_type", "message" ], "properties": { "type": { "type": "string", "description": "The category of reversal error.", "enum": [ "PAYMENT_REVERSAL_FAILED" ] }, "code": { "type": "integer", "description": "Numeric error code (14XXX range).", "enum": [ 14001, 14002, 14003 ] }, "sub_type": { "type": "string", "description": "Specific reversal error classification.", "enum": [ "PAYMENT_REVERSAL_INSUFFICIENT_FUNDS", "PAYMENT_REVERSAL_UNAUTHORIZED", "PAYMENT_REVERSAL_INVALID_ACCOUNT" ] }, "message": { "type": "string", "description": "Human-readable error description." } } }, "SuccessEnvelope": { "type": "object", "description": "Standard envelope for successful responses that return a single payload.", "required": [ "success", "data", "message" ], "properties": { "success": { "type": "boolean", "description": "Always `true` for successful responses." }, "data": { "description": "Operation-specific response payload." }, "message": { "type": [ "string", "null" ] } } } } }