Check Balance
Step 1: Get Access Token
Please refer to
Access Token
on how to get Access Token,
and then place it into Request Headers'
Authorization.
Step 2: Prepare Request Parameter
Generate
nonceStr and
timestamp,
which will be placed into Request Headers and also be used to create
Signature.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
nonceStr |
String | Yes | Random String | 7a70f55482a5566c |
timestamp |
String | Yes | UNIX timestamp of request | 1667061151361 |
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| - | - | No | This request does not require any request parameters. Send an empty JSON object. | {} |
Example Request
{}
Sort the above JSON key alphabetically and make it compact
{}
Encode the data to Base64 format
e30=
Encode the Base64 format data with CLIENT_SYMMETRIC_KEY
e4e9ac1120ed867a7af108af8b1ab918b7c8e32e31f9f6d6ca5abf0ad4a882462067f58dbd76446b344f2f5849144ab9
Step 3: Generate Signature
Please refer to Signature Algorithm on how to get Signature, and then place it into Request Headers' X-Signature.
Step 4: POST to
/gateway/v1/getBalance
endpoint
Method : POST
Endpoint: https://api.superpay.club/gateway/v1/getBalanceRequest
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization |
Number | Token get from Step 1 |
X-Nonce-Str |
String | nonceStr from Step 2 |
X-Timestamp |
String | timestamp from Step 2 |
X-Signature |
String | signature from Step 3 |
Body
| Parameter | Type | Description | Example |
|---|---|---|---|
data |
String | Encrypted Data using CLIENT_SYMMETRIC_KEY | e4e9ac1120ed...49144ab9 |
Example Request Header & Body
{
"headers": {
"Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"X-Nonce-Str": "7a70f55482a5566c",
"X-Timestamp": "1667061151361",
"X-Signature": "sha256 zOzjz8QoGTbesuAO5CCFbPCF3EMDtohKtkQ..."
},
"body": {
"data": "e4e9ac1120ed867a7af108af8b1ab918b7c8e32e31f9f6d6ca5abf0ad4a882462067f58dbd76446b344f2f5849144ab9"
}
}
Response
Body
| Parameter | Type | Description | Example |
|---|---|---|---|
code |
String | The status code of this API | 1 |
encryptedData |
String | Encrypted Data that required be decrypted with CLIENT_SYMMETRIC_KEY |
a83cf72884cbbb....3ddf0744646e0cf0b482 |
message |
String | PlainText information of this balance request | success |
Example Response
{
"code": "1",
"encryptedData": "a83cf72884cbbb....3ddf0744646e0cf0b482",
"message": "success"
}
Step 5: Decrypt the encryptedData with CLIENT_SYMMETRIC_KEY
Symmetric decrypt the
encryptedData,
a83cf72884cbbb....3ddf0744646e0cf0b482
with
CLIENT_SYMMETRIC_KEY,
PCd1dlEmFnBXaVce06Pzp7Vike0oHnVJ
The result is in plaintext as
{
"code": "1",
"data": {
"available_balance": 1250.25,
"pending_balance": 50.00,
"locked_balance": 20.00
},
"message": "success"
}