token
token
Use this method to generate a public token 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 | - | object | Data required by the tokenization widget |
acquiring_widget | - | object | Data required by the payment form widget |
fps_no_account_widget | - | object | Data required by the payment form for money transfers |
Request examples
- tokenize_widget
- acquiring_widget
- fps_no_account_widget
Get 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"
}
}'
Get a token for the payment form widget.
To get a token for the payment form widget with the recurring payments option, pass "show_recurrent_checkbox": "true"
.
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"
}
}'
Get 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 | - | object | Error description |
Successful response example
{
"status": "ok",
"public_token": "e065c2f1328e74156a883c00e210a4b1b1451782bbfdd18ae8d05715e05d8548"
}
Unsuccessful response example
{
"status": "error",
"error": {
"description": "error description",
"code": "error code"
}
}