Method cancelOperation
Description
The method is designed to cancel full and/or partial redemption of a certificate. To perform the cancellation, it is necessary to retain the identifier of the original redemption operation.
Here’s the translation for the request and response parameters:
Request Parameters (data)
| Parameter | Type | Description |
|---|---|---|
| code | string | Required. Certificate code. |
| transaction_id | int | Required. Redemption operation ID. Returned by the redeemCertificate method in the transaction_ids parameter. |
| string | Required. Email of the employee who performed the operation (in case of automatic cancellation, a placeholder like noreply@{yourdomain}.{tld} can be used). | |
| comment | string | Comment for the operation cancellation. |
Response Parameters (data)
| Parameter | Type | Description |
|---|---|---|
| canceled | bool | Indicates whether the redemption operation was successfully canceled. |
Example
bash
# Get the value for the SIG substitution
# SECRET in this case is the key stored by the client to sign API requests
$ echo -n 'cancelOperation{"code":"00342-999-999-999","transaction_id":999,"email":"noreply@giftery.es"}SECRET' | sha256sum - | awk '{print $1}'
# Use the client's known ID and the generated SIG to execute the request
$ curl 'https://api.giftery.es/v1/?cmd=cancelOperation&id=ID&in=json&out=json&data=%7B%22code%22%3A%2200342-999-999-999%22%2C%22transaction_id%22%3A999%2C%22email%22%3A%22noreply%40giftery.es%22%7D&sig=SIG'Result of a successful request
JSON
{
"status": "ok",
"data": {
"canceled": true
}
}Result in case of error
JSON
{
"status": "error",
"error": {
"code": 1402,
"text": "Certificate not found"
}
}| Error Code | Description |
|---|---|
| 1402 | The certificate could not be found using the provided code. Please check if the code was passed correctly. The PIN code is only verified if the certificate is found. |
| 1403 | The certificate has been blocked. You can clarify the reason for the block with a personal manager. |
| 3601 | The operation cancellation time has been exceeded. The redemption operation being canceled was made more than 5 days ago. |