Skip to content

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) ​

ParameterTypeDescription
codestringmandatory. Certificate code.
pinstringoptional. Secret code.

Response parameters (data) ​

ПараметрТипОписание
order_idintegerorder identifier
product_idintegerproduct identifier
faceintegeravailable certificate denomination. The denomination does not change during the lifetime of the certificate.
balanceintegeravailable 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_redeembooleanEnable partial redemption
available_number_of_usesintNumber of remaining partial redemptions. The value can be 0, in which case the number of redemptions is unlimited.
number_of_usesintnumber of partial redemptions used
expire_datestringexpiration date and time
redeemedbooleanwhether the certificate has already been redeemed
expiredbooleanWhether the certificate has expired
pin_is_correctbooleanWhether the certificate pin code was entered correctly
product_titlestringProduct 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 codeDescription
1402Failed 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.
1403The certificate has been blocked. You can check the reason for blocking with your personal manager.