token/info
token/info
Operations with bank cards are often carried out with tokenized values. For payments and payments through widgets, a public token is created. For recurrent payments, a recurrent token is created.
For any payment token you can get information:
- about the bank card for which that token was created: the hidden card number and payment system,
- about the token itself: the type of token, time of creation, expiration date, active or inactive at the moment of inquiry.
This method can be used, for example, to learn the hidden card number and show the user from which card the funds will be debited, or to check the token expiration date.
Endpoint
api/v1/token/info
Request parameters
Name | Mandatory | Type | Description |
---|---|---|---|
type | + | string | Request type. Options: card , public_token , recurrent_token |
card | - (mandatory for type = card ) | CardPaymentMethod | Bank card details |
public_token | - (mandatory for type = public_token ) | PublicToken | Token details |
recurrent_token | - (mandatory for type = recurrent_token ) | RecurrentToken | Recurrent token details |
Response parameters
Name | Mandatory | Type | Description |
---|---|---|---|
status | + | string | Status. Options: error , ok |
info | - | CardTokenInfo/PublicTokenInfo/RecurrentTokenInfo | Information on the token depending on the request type (type ) |
error | - | Error | Error |
Request for card information
You send tokenized bank card details and receive the hidden card number and payment system.
- Request
- Response
curl --location --request POST 'https://demo.smart-glocal.com/api/v1/token/info' \
--header 'X-PARTNER-PROJECT: partner-project' \
--header 'X-PARTNER-SIGN: key' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "card",
"card": {
"type": "encrypted_card",
"encrypted_card": {
"number_hash": "card_number_hash (token)"
}
}
}'
{
"status": "ok",
"info": {
"number_hash": "card_number_hash",
"brand": "visa",
"last4": "4242",
"type": "card"
}
}
Request for public token information
You send a public token and receive information on it.
- Request
- Response
curl --location --request POST 'https://demo.smart-glocal.com/api/v1/token/info' \
--header 'X-PARTNER-PROJECT: partner-project' \
--header 'X-PARTNER-SIGN: key' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "public_token",
"public_token": {
"token": "your_token"
}
}'
{
"status": "ok",
"info": {
"token": "your_token",
"created_at": "2021-03-17T14:10:56+03:00",
"finished_at": "2021-03-18T14:10:56+03:00",
"is_active": true,
"type": "public_token"
}
}
Request for recurring token information
You send a recurring token and receive information on it.
- Request
- Response
curl --location --request POST 'https://demo.smart-glocal.com/api/v1/token/info' \
--header 'X-PARTNER-PROJECT: partner-project' \
--header 'X-PARTNER-SIGN: key' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "recurrent_token",
"recurrent_token": {
"token": "your_token"
}
}'
{
"status": "ok",
"info": {
"token": "your_token",
"created_at": "2021-03-17T14:19:05+03:00",
"finished_at": "2021-04-17T14:19:05+03:00",
"is_active": true,
"type": "recurrent_token"
}
}
Unsuccessful response example
{
"status": "error",
"error": {
"description": "error description",
"code": "error code"
}
}