Method checkCertificate
Description
The method is intended to get information about the certificate. It is possible to check correctness of code and pin input, certificate validity period, available certificate denomination. After checking the certificate parameters, the redeemCertificate method can be called.
Request Parameters (data)
| Parameter | Type | Description |
|---|---|---|
| code | string | mandatory. Certificate code. |
| pin | string | optional. Secret code. |
Response parameters (data)
| Параметр | Тип | Описание |
|---|---|---|
| order_id | integer | order identifier |
| product_id | integer | product identifier |
| face | integer | available certificate denomination. The denomination does not change during the lifetime of the certificate. |
| balance | integer | available balance of the certificate. The balance decreases after partial or full redemption. In some cases the balance of the certificate may be lower than the face value initially. When displayed in the interface, it is necessary to show the certificate balance instead of the surftikiat denomination. |
| allow_partial_redeem | boolean | Enable partial redemption |
| available_number_of_uses | int | Number of remaining partial redemptions. The value can be 0, in which case the number of redemptions is unlimited. |
| number_of_uses | int | number of partial redemptions used |
| expire_date | string | expiration date and time |
| redeemed | boolean | whether the certificate has already been redeemed |
| expired | boolean | Whether the certificate has expired |
| pin_is_correct | boolean | Whether the certificate pin code was entered correctly |
| product_title | string | Product title |
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 'checkCertificate{"code":"00342-999-999-999","pin":"9999"}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=checkCertificate&id=ID&in=json&out=json&data=%7B%22code%22%3A%2200342-999-999-999%22%2C%22pin%22%3A%229999%22%7D&sig=SIG'Result of a successful request
JSON
{
"status": "ok",
"data": {
"order_id": 9999999,
"product_id": 9999,
"face": 10000,
"balance": 9000,
"allow_partial_redeem": true,
"available_number_of_uses": 10,
"number_of_uses": 0,
"expire_date": "2021-02-05 15:21:20",
"redeemed": false,
"expired": false,
"pin_is_correct": true,
"product_title": "Giftery Card"
}
}Result in case of error
JSON
{
"status": "error",
"error": {
"code": 1402,
"text": "Certificate not found"
}
}| Error code | Description |
|---|---|
| 1402 | Failed to find a certificate using the code provided. It is necessary to check if the code was transmitted correctly. The pin code is only checked if the certificate has been found. |
| 1403 | The certificate has been blocked. You can check the reason for blocking with your personal manager. |