TF Fiscal

NFC-e 消费者发票

POST/api/nfce/cancel

取消 NFC-e

取消已授权的 NFC-e。与 NFe 不同,这里取消原因由客户提供并转发给税务局。税务局取消窗口很短(通常授权后 15-30 分钟)。

必需请求头

tokenstringstring开票公司令牌
signstringstringMD5 签名
timestampstringstring秒级 Unix 时间戳

Body

chave*stringstringNFC-e 的 44 位访问密钥(注意:这里是 chave,而非其他端点中的 uuid)
motivo*stringstring取消理由(税务局要求)。

 * 必填字段。

返回字段(data)

motivostringstring税务局对取消事件的官方消息
statusstringstring状态:"Canceled"(已取消)
nfceintint已取消的 NFC-e 号码
serieintintNFC-e 系列号
chavestringstring44 位访问密钥
modelostringstring单据模型:"nfce"
cStatintint税务局事件代码:135 或 155 = 取消已核准。

返回 — 错误

当税务局拒绝该事件时(如超过取消期限),success 为 false,data 中带有 status: "Failed" 和被拒的 cStat。校验错误(缺少 chave/motivo、motivo 少于 15 个字符、找不到 NFC-e、应急开具尚未传输)返回 success: false,消息位于 message,且没有 data 对象。
{
  "success": false,
  "data": {
    "motivo": "Rejeição: Pedido de Cancelamento intempestivo",
    "status": "Failed",
    "nfce": 5,
    "serie": 1,
    "chave": "35210112345678901234650010000000051234567890",
    "modelo": "nfce",
    "cStat": 501
  }
}

示例

# sign = md5(token + path + body + timestamp)
# 按接口路径生成的调用模板,占位符替换为实际值
curl -X POST "https://api.tffiscal.com/api/nfce/cancel" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json