# Cancel a refund (/api-reference/refunds/payments-refunds-cancel) > Cancels a refund of the payment that has not been sent yet. Every refund waits until its cancelableUntil (4 hours) before it is sent, and can be canceled until then; it then reads canceled, and its amount can be refunded again. Answers 204 when canceled (also for a refund canceled before), 409 once it can no longer be canceled (after cancelableUntil, or once decided) or while other refunds of the payment are being changed (try again), and 404 for a refund of another payment, or of another merchant's. Requires the `payments:refund` scope. `DELETE https://gateway.mps-emi.com/api/payments/{paymentReference}/refunds/{refundId}` ```json { "tags": [ "Refunds" ], "summary": "Cancel a refund", "description": "Cancels a refund of the payment that has not been sent yet. Every refund waits until its cancelableUntil (4 hours) before it is sent, and can be canceled until then; it then reads canceled, and its amount can be refunded again. Answers 204 when canceled (also for a refund canceled before), 409 once it can no longer be canceled (after cancelableUntil, or once decided) or while other refunds of the payment are being changed (try again), and 404 for a refund of another payment, or of another merchant's.\n\nRequires the `payments:refund` scope.", "operationId": "payments-refunds-cancel", "parameters": [ { "name": "x-wallet-number", "in": "header", "description": "Only with a partner key, on every call: the wallet of the merchant this call acts for, such as BE0000000000. A test key or a merchant key acts for its own wallet and ignores it.", "schema": { "type": "string" } }, { "name": "paymentReference", "in": "path", "description": "The paymentReference create returned, exactly as returned.", "required": true, "schema": { "type": "string" }, "examples": { "default": { "value": "00000000-0000-4000-8000-000000000001" } } }, { "name": "refundId", "in": "path", "description": "The refundId the refund request returned.", "required": true, "schema": { "type": "string" }, "examples": { "default": { "value": "3f2b8c1e-6d4a-4f7e-9b21-5c8d0e7a4b19" } } } ], "responses": { "204": { "description": "No Content", "headers": { "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } } }, "401": { "description": "No API key, or a wrong, malformed or revoked one: no body.", "headers": { "WWW-Authenticate": { "description": "Bearer error=\"invalid_token\".", "schema": { "type": "string" } }, "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } } }, "403": { "description": "The key does not carry the payments:refund scope, or a partner key sent no x-wallet-number: no body. x-wallet-number names a wallet the key does not cover: the body below, error invalid_request.", "headers": { "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } }, "content": { "application/json": { "schema": { "required": [ "error", "error_description" ], "type": "object", "properties": { "error": { "type": "string", "description": "invalid_request." }, "error_description": { "type": "string", "description": "Why the wallet was refused, for a person." } }, "examples": [ { "error": "invalid_request", "error_description": "The requested wallet is not covered by this key's account." } ] } } } }, "404": { "description": "No such refund of this payment for this merchant (a refund of another payment, or of another merchant's, answers the same). No body.", "headers": { "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } } }, "409": { "description": "A conflict, named by code: refund_not_cancelable (the refund was sent or decided: do not retry, read it) or refund_in_progress (other refunds of the payment are being changed: retry after a second).", "headers": { "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } }, "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/ConflictProblem" } } } }, "429": { "description": "Over the 100 requests a minute per API key, shared by every endpoint, or more than 10 failed API keys a minute from your address: no body. Wait the number of seconds in Retry-After, then retry.", "headers": { "Retry-After": { "description": "Seconds to wait before retrying.", "schema": { "type": "integer" } }, "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } } }, "500": { "description": "A problem on our side, as a problem document with the traceId to quote to MPS. Other 5xx answers can carry no body. Retry a read with backoff; retry a create or refund only with the same Idempotency-Key.", "headers": { "traceparent": { "description": "The call's W3C trace: 00-{trace id}-{span id}-{flags}. Sent on every answer, a success or a refusal without a body included. Quote it when you contact MPS about the call; its trace id is the one in a problem's traceId.", "schema": { "type": "string" }, "examples": { "default": { "value": "00-a27c57cb2b3e4f5d8c9a0b1c2d3e4f50-1a2b3c4d5e6f7a8b-01" } } } }, "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/ServerProblem" } } } } }, "security": [ { "apiKey": [] } ] } ``` Schemas referenced as `#/components/schemas/…` are defined in the full document at /openapi.json.