V Cloud SDK API Guide
Overview
This endpoint provides api for uploading service template, receiving user payment event webhook, handling order refund and managing user serivces.
Upload Service Template
GET /api/v1/service/template/add
The server will read the request body for service template and create service information. Please refer to service template explanation for template details.
VSYS Payment Webhook
POST /api/v1/listener/vsys
The request body of this api is event trigger payment event sending from event trigger module in VSYS node.
Order Refund API
Get Order Information
GET /api/v1/order/id/:id
Please refer to order fields for order response
Service Call Refund
This api is for merchant's resource node to refund an order when the resource is out-of-limit.
POST /api/v1/order/serviceRefund/:id
where id
is order id.
Request Body
{
"stopService": true
}
The request body is a json dict containing key field.
Field Name | Type | Explanation |
---|---|---|
stopService | bool | if to call stop lua-script when doing refund |
User Call Refund
POST /api/v1/order/userRefund/:id
where id
is order id.
User Service API
Query User Service
GET /api/v1/userService?
Fields of Query Parameters
Field Name | Type | Explanation |
---|---|---|
id | string | order id |
address | string | user services that are related to this address |
serviceID | string | user services that are related to this service id |
service | string | service name related |
statuses | string[] | user services that are in these statuses |
startFrom | number | user service objects that are created after this timestamp |
endAt | number | user service objects that are created before this timestamp |
current | number | current page |
pageSize | number | page size |
Response
{
"list": [
{
"createdAt": 1623143606,
"updatedAt": 1623143606,
"duration": 100,
"endAt": 0,
"serviceID": "53bc15ca-e6f8-42ef-a814-8c5f14d22b79",
"service": "Container Service",
"address": "AU2TxxxxxxxxxxxxxxxxxxxxxxxGp5sj",
"userServiceID": "9c547686-aaac-4c0d-9036-df4abba7d097",
"serviceOptions": {
"portSpecification": "User Specified Service Port",
"resourceUnit": "1-Unit-Resource"
},
"status": "ServiceRunning",
"magic": "VzvCRsqQ4vF8twxKcpRmt8gfHpQSjJRFRhY1ijnMdVQzuufKNtar6oV7vqom1bWtAYoYNWY1orypwfV7kAUVvyeEmdV7",
"serviceActiveTS": 1623143606,
"serviceRunningTS": 1623143606,
"serviceAbortTS": 0,
"serviceDoneTS": 0
}
],
"pagination": {
"total": 1,
"current": 1,
"pageSize": 10
}
}
Fields of user service item in list
Field Name | Type | Explanation |
---|---|---|
createdAt | number | user service object creation time |
updatedAt | number | user service object updated time |
duration | number | service duration in hour |
endAt | number | service ending timestamp after user starts using the service |
serviceID | string | service id that it relates to |
service | string | service name |
address | string | user address |
userServiceID | string | the same as order id |
serviceOptions | string | service options that this user service used |
status | string | user service status |
magic | string | It, encrypted by user public key, is for using service |
serviceActiveTS | number | user service active time, which is user paid time |
serviceRunningTS | number | user service starts running time |
serviceAbortTS | number | user service abortion time |
serviceDoneTS | number | user service finished time |
Get User Service
GET /api/v1/userService/:id
where id
is order id.
The response please refer to user service fields
Start User Service Timing
POST /api/v1/userService/start/:orderId
This api is to notify SDK node of counting service time.
Stop Expired User Service
POST /api/v1/userService/stop
This api allows merchant to stop user service manually.