# midasPresent

本接口应在后端服务器调用

It enables you to gift a user the game coins for the Mini Game with virtual payment activated.

# Formal environment

POST https://api.weixin.qq.com/cgi-bin/midas/present?access_token=ACCESS_TOKEN

# Sandbox environment

POST https://api.weixin.qq.com/cgi-bin/midas/sandbox/present?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 role selecting, the zone ID is followed by the role ID with an underline(_).
pf string yes Platform: Android
user_ip string no User's Internet IP
bill_no string yes Order ID, which requires unique value; recurring payment will not occur for the same ID It should be no more than 63 characters including numbers, uppercase and lowercase letters_- *@
present_counts number yes Number of game coins to gift, which cannot be 0
sig string yes All parameters above (up to 9 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 11 including optional parameters) + uri + session_key, with HMAC SHA256 signature. 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 Balance after the gift sending
bill_no string Order number for which to gift the game coins

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
90012 Order already exists
90017 No interface calling permissions
90018 Parameter error

# POST data format: JSON

{
    "openid":"odkx20ENSNa2w5y3g_qOkOvBNM1g",
    "appid":"wx1234567",
    "offer_id":"12345678",
    "ts":1507530737,
    "zone_id":"1",
    "pf":"android",
    "present_counts":233,
    "bill_no":"BillNo_123",
    "sig":"e53e5241bbb014b3a9fcc221d66fecab8734b53fe94d7a8c65180e175e29f443",
    "mp_sig":"39271a12d8d56b0395981a0990a9e75ae239c54f419cb6235399fe70acf8ccfb"
}
点击咨询小助手