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
Name | Mandatory | Type | Description |
---|---|---|---|
tokenize_widget | - | TokenizeWidgetMetadata | Data required by the tokenization widget |
acquiring_widget | - | AcquiringWidgetMetadata | Data required by the payment form widget |
fps_no_account_widget | - | FpsNoAccountWidgetMetadata | Data required by the payment form for money transfers |
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: signature' \
-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: signature' \
-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: signature' \
-d '{
"acquiring_widget": {
"session_id": "ps_123456",
"locale":"en",
"show_recurrent_checkbox": "true"
}
}'
Getting a token for the payment form for money transfers
curl -L 'https://demo.smart-glocal.com/api/v1/token' \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-H 'X-PARTNER-SUBMERCHANT: submerchant ID' \
-d '{
"fps_no_account_widget": {
"session_id": "ps_123456",
}
}'
Response parameters
Name | Mandatory | Type | Description |
---|---|---|---|
status | + | string | Status. Options: error , ok |
public_token | - | string | Public token |
error | - | Error | Error |
Successful response example
{
"status": "ok",
"public_token": "e065c2f1328e74156a883c00e210a4b1b1451782bbfdd18ae8d05715e05d8548"
}
Unsuccessful response example
{
"status": "error",
"error": {
"description": "error description",
"code": "error code"
}
}