Skip to main content

token

token

Generates a public token needed to access Smart Glocal's JavaScript library and to work with the widgets.

The token is valid for 24 hours. It can only be used for a single operation.

Endpoint

api/v1/token

Request parameters

NameMandatoryTypeDescription
tokenize_widget-TokenizeWidgetMetadataData required by the tokenization widget
acquiring_widget-AcquiringWidgetMetadataData required by the payment form widget

Request examples

Getting a token for the tokenization widget
curl -X POST \
http://demo.smart-glocal.com/api/v1/token \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 721af394d5a7aefd0e91f5390abc4d7e20fb2b5784b091fef621f3c61b7abb4b' \
-d '{
"tokenize_widget": {
"access": true,
"locale": "en"
}
}'
Getting a token for the payment form widget
curl -X POST \
http://demo.smart-glocal.com/api/v1/token \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 721af394d5a7aefd0e91f5390abc4d7e20fb2b5784b091fef621f3c61b7abb4b' \
-d '{
"acquiring_widget": {
"session_id": "ps_123456",
"locale":"en"
}
}'
Getting a token for the payment form widget with the recurrent payments option
curl -X POST \
http://demo.smart-glocal.com/api/v1/token \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 721af394d5a7aefd0e91f5390abc4d7e20fb2b5784b091fef621f3c61b7abb4b' \
-d '{
"acquiring_widget": {
"session_id": "ps_123456",
"locale":"en",
"show_recurrent_checkbox": "true"
}
}'

Response parameters

NameMandatoryTypeDescription
status+stringStatus. Options: error, ok
public_token-stringPublic token
error-ErrorError

Successful response example

{
"status": "ok",
"public_token": "e065c2f1328e74156a883c00e210a4b1b1451782bbfdd18ae8d05715e05d8548"
}

Unsuccessful response example

{
"status": "error",
"error": {
"description": "error description",
"code": "error code"
}
}