Skip to content

Receipt Cancellation

Method for canceling a self-employed individual's receipt.

URL

Method: POST

  • Production: https://api.baas.kvell.group/v1/smz/receipts/{receipt_id}/cancel
  • Stage: https://api.baas.stage.kvell.group/v1/smz/receipts/{receipt_id}/cancel

Request parameters

Name Data type Required Description
receipt_id integer Yes Unique receipt identifier

Request body

The request body is optional. If it is not passed, the receipt is canceled with the reason REGISTRATION_MISTAKE.

Name Data type Required Description
reason string No Cancellation reason: REGISTRATION_MISTAKE — the receipt was generated by mistake, REFUND — refund of funds by the self-employed individual
{
  "reason": "REFUND"
}

The reason is passed to the Federal Tax Service (FNS) along with the cancellation request, so specify it based on the actual grounds.

Which receipts can be canceled

A receipt can be canceled in either of the following statuses:

  • ready — the income has been registered with the FNS;
  • await_confirm — the receipt is registered and awaiting confirmation from the self-employed individual.

A receipt in any other status cannot be canceled — the method returns error 32.

For a receipt in the await_confirm status, cancellation is not available immediately: in the first few minutes after the receipt is created, its identifier has not yet been obtained from the income registration system, and the method returns error 35. In that case, retry the request later.

Request headers

Name Data type Required Description
X-Api-Key string Yes Unique shop identifier
X-Signature string Yes Signature

The X-Signature signature is generated by concatenating X-Api-Key, receipt_id, and secret_key. It is computed as sha256 of the resulting string:

sha256({X-Api-Key}{receipt_id}{secret_key})

where secret_key is the secret key found in the merchant's shop settings.

The cancellation reason is not included in the signature: the signature is generated using only receipt_id, regardless of whether a request body was passed.

Response

An example response for this request can be found in the self-employed receipt information method.

On success, the receipt is returned in the canceling status — the cancellation has been accepted and sent to the FNS. The final canceled status is set later; it can be retrieved using the receipt retrieval method or obtained via a callback.

Errors

Code Message Meaning
30 Receipt not found There is no receipt with this receipt_id, or it belongs to a different shop
32 Receipt cannot be canceled The receipt status is neither ready nor await_confirm
35 Receipt cannot be canceled yet, try again later The receipt is in await_confirm status and its identifier has not yet been obtained from the income registration system

For a full description, see the BAAS API error reference.