Web payment API(s)
*Enter giftcode from web
Description
Allow user use giftcode from web
Request
Protocol
POST
URL
Partner sends to VGP this url
Content-Type
multipart/form-data
Parameter(s)
| No | Parameter | Type | Note |
|---|---|---|---|
| 1 | vgp_id | long (bigint) | VGP identification |
| 2 | server_id | String | Server identification |
| 3 | role_id | String | Role ID |
| 4 | giftcode | String | Giftcode |
Response
Content-Type
application/json
Format
{
"code": [code],
"message": [error messange]
}
in which
| No | Variable | Type | Note |
|---|---|---|---|
| 1 | code | Integer | Result. 0 if successful. Otherwise, error |
| 2 | error messange | String | Error detail |
Example
Request
POST http://fakeserver/get-role
Response
{
"code": 0,
"message": "OK"
}
{
"code": 1,
"message": "invalid giftcode"
}
*Payment token retrieval
Description
Get payment token from partner for a specific user
Request
Protocol
POST
URL
Partner sends to VGP this url
Content-Type
multipart/form-data
Parameter(s)
| No | Parameter | Type | Note |
|---|---|---|---|
| 1 | vgpid | long (bigint) | VGP identification |
| 2 | server_id | String | Server identification |
| 3 | role_id | String | Role identification |
| 4 | item_id | String | Item ID |
| 5 | tstamp | long | unix timestamp at paid time |
| 6 | ticket | String | Verified code which is calculated as below |
ticket is calculated from md5 of value below {Payment_Token_Verification}vgpid{vgpid}server_id{server_id}role_id{role_id}item_id{item_id}tstamp{unix_time}
Response
Content-Type
application/json
Format
{
"token":{payment_token},"expired": {expired_date}
}
in which
| No | Variable | Type | Note |
|---|---|---|---|
| 1 | payment_token | String | Payment token |
| 2 | expired_date | long | Expired time in Unix time |
| 3 | code | int | 0 if success otherwise false |
| 4 | error | String | error detail |
Example
Request
GET http://fakeserver/get-token
Response
Success
{"token":"vgp123456","expired":1479238963, "code" : 0, "error" : ""}
Failure
{"token":"null","expired":0, "code" : 1, "error" : "Internal Error"}
Roles retrieval
Description
Get roles of specific user in all servers
Request
Protocol
POST
URL
Partner sends to VGP this url
Content-Type
multipart/form-data
Parameter(s)
| No | Parameter | Type | Note |
|---|---|---|---|
| 1 | vgp_id | long (bigint) | VGP identification |
| 2 | timestamp | long (bigint) | Unix Time |
Response
Content-Type
application/json
Format
{
"t": unix_time
"roles":
[{"id":{user_role}, "server_id": {server_id}, "server_name": {server_name} , "name":{role_name}, "lv": {user_level}, "role_time": {role_created_time}},
…
]
}
in which
| No | Variable | Type | Note |
|---|---|---|---|
| 1 | user_role | String | Role identification |
| 2 | role_name | String | Role name |
| 3 | user_level | Integer | Role level |
| 4 | Server_id | String | server id |
| 5 | server_name | String | server name |
| 6 | tstamp | long | unix time |
| 7 | role_created_time | long | Role creation time (unix time) |
Example
Request
POST http://fakeserver/get-role
Response
{"timestamp": 122334, "roles":[{"id":"1", "server_id": "1111", 'server_name': "s1" , "name":"Hoa Sơn", "lv":10} ,{"id":"100","server_id": "222",'server_name': "s1", "name":"Cửu Sơn", "lv":100, "role_time": 1758613846} …]}