# midasGetBalance
本接口应在后端服务器调用
It enables you to view a user's remaining game coins for the Mini Game with virtual payment activated
# Formal environment
POST https://api.weixin.qq.com/cgi-bin/midas/getbalance?access_token=ACCESS_TOKEN
# Sandbox environment
POST https://api.weixin.qq.com/cgi-bin/midas/sandbox/getbalance?access_token=ACCESS_TOKEN
# 请求Parameter
property | type | default value | optional | description | version |
---|---|---|---|---|---|
openid | string | yes | User unique identifier | ||
appid | string | yes | Mini Program appId | ||
offer_id | string | yes | offer_id distributed by Midas | ||
ts | number | yes | UNIX timestamp in seconds | ||
zone_id | string | yes | Game server zone ID; if the game servers are not classified by zones, the default zoneId ="1", and it is string type. If the app supports selecting role, the zone ID is followed by role ID by using "_". | ||
pf | string | yes | Platform: Android | ||
user_ip | string | no | User's Internet IP | ||
sig | string | yes | All parameters above (up to 7 including optional parameters) + uri + Midas key, with HMAC-SHA256 signature. For details, please see Midas payment signature algorithm | ||
access_token | string | yes | Proof of interface call | ||
mp_sig | string | yes | All parameters above (up to 9 including optional parameters) +uri+session_key are signed by HMAC-SHA256. For details, please see Midas payment signature algorithm |
# Return
# Object
Returned JSON data package
property | type | description | version |
---|---|---|---|
errcode | number | Error code | |
errmsg | string | Error message | |
balance | number | Number of game coins (including gift coins) | |
gen_balance | number | Number of gift coins (number of gift coins) | |
first_save | boolean | Whether it is the first ever top up | |
save_amt | number | Total amount of top-up game coins | |
save_sum | number | Sum of all saved game coins | |
cost_sum | number | Sum of all costed game coins | |
present_sum | number | Sum of all gift game coins received |
errcode 's struct
value | description |
---|---|
0 | Request successful |
-1 | System busy, the developer is requested to try again later |
90009 | mp_sig signature error |
90010 | User has not logged in, or login status has expired |
90011 | sig signature error |
90017 | No interface calling permissions |
90018 | Parameter error |
first_save 's struct
value | description |
---|---|
1 | Yes |
2 | No |
# POST data format: JSON
{
"openid":"odkx20ENSNa2w5y3g_qOkOvBNM1g",
"appid":"wx1234567",
"offer_id":"12345678",
"ts":1507530737,
"zone_id":"1",
"pf":"android",
"sig":"d1f0a41272f9b85618361323e1b19cd8cb0213f21b935aeaa39c160892031e97",
"mp_sig":"ff4c5bb39dea1002a8f03be0438724e1a8bcea5ebce8f221f9b9fea3bcf3bf76"
}