---
title: "Refund sales receipt"
description: "Register a receipt refund. A refund may create a CFDI credit note; use the returned receipt refund document to follow its lifecycle."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/refund_sales_receipt"
md_url: "https://exac.mx/docs/en/mcp/tools/refund_sales_receipt.md"
---

# Refund sales receipt

Register a receipt refund. A refund may create a CFDI credit note; use the returned receipt refund document to follow its lifecycle.

Tool: `refund_sales_receipt`

## Purpose

Register a sales receipt refund and, when applicable, create a CFDI credit note.

### Use when

A customer refund has been approved.

### Do not use when

The transaction should be voided before settlement or is not a receipt refund.

| Detail | Value |
| --- | --- |
| Permissions | receipts:refund |
| Side effects | Destructive and external |
| Idempotency | Idempotent |

## Input schema

```json
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    },
    "input": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "reason": {
          "type": "string",
          "enum": [
            "commercial_refund",
            "resico_reconciliation"
          ]
        },
        "settlementMethod": {
          "type": "string",
          "enum": [
            "cash",
            "transfer",
            "original_method",
            "customer_credit"
          ]
        },
        "allocations": {
          "minItems": 1,
          "type": "array",
          "items": {
            "$ref": "#/definitions/__schema0"
          }
        },
        "note": {
          "type": "string"
        },
        "documentRef": {
          "type": "string",
          "pattern": "^sales_receipt:.+$"
        }
      },
      "required": [
        "amount",
        "reason",
        "settlementMethod",
        "documentRef"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "original_line"
            },
            "lineRef": {
              "type": "string",
              "minLength": 1
            },
            "adjustmentMode": {
              "type": "string",
              "const": "quantity"
            },
            "quantity": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          "required": [
            "kind",
            "lineRef",
            "adjustmentMode",
            "quantity"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "original_line"
            },
            "lineRef": {
              "type": "string",
              "minLength": 1
            },
            "adjustmentMode": {
              "type": "string",
              "const": "amount"
            },
            "amount": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          "required": [
            "kind",
            "lineRef",
            "adjustmentMode",
            "amount"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "custom"
            },
            "description": {
              "type": "string",
              "minLength": 1
            },
            "quantity": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "amount": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "productKey": {
              "type": "string",
              "minLength": 1
            },
            "unitKey": {
              "type": "string",
              "minLength": 1
            },
            "taxability": {
              "type": "string",
              "enum": [
                "standard",
                "zero",
                "exempt"
              ]
            },
            "taxRate": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "taxIncluded": {
              "type": "boolean"
            }
          },
          "required": [
            "kind",
            "description",
            "quantity",
            "amount",
            "productKey",
            "unitKey",
            "taxability",
            "taxRate",
            "taxIncluded"
          ],
          "additionalProperties": false
        }
      ]
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "documentRef": {
          "type": "string",
          "pattern": "^sales_receipt_refund:.+$"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "processing",
            "completed",
            "failed",
            "recovery_required",
            "canceled"
          ]
        }
      },
      "required": [
        "documentRef",
        "status"
      ],
      "additionalProperties": false
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "message": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "retryable": {
              "type": "boolean"
            },
            "retryAfterSeconds": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Related tools

- [`get_document`](/docs/en/mcp/tools/get_document.md) — **Get document**: Retrieve one document by its public documentRef. Sales receipt details include stable lineRef values and remaining refundable amounts for sales receipt refunds.

- [`search_documents`](/docs/en/mcp/tools/search_documents.md) — **Search documents**: Search one public document family at a time. Use cfdi for income, credit-note, transfer, payroll, and payment-complement documents; use withholding, sales_receipt, quote, expense, declaration, tax_compliance_opinion, or sales_receipt_refund for the other families.

## Related workflow

[See the canonical workflows in the introduction](/docs/en.md)

## Equivalent REST operations

- [`POST /v1/sales-receipts/{documentRef}/refunds`](/docs/en/api/documents/sales-receipts/create-sales-receipt-refund.md)

Complete documentation: https://exac.mx/docs/en.md
Agent documentation index: https://exac.mx/docs/en/llms.txt
