# wx.requestMidasPayment(Object object)
Initiates MIDAS payment.
# Parameters
# Object object
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
mode | string | Yes | Payment type. Corresponding additional parameters are required for different payment types. | |
env | number | 0 | No | Environment settings |
offerId | string | Yes | The app ID applied for on the MIDAS side | |
currencyType | string | Yes | Currency | |
platform | string | No | The platform used to apply for access, which is related to the app ID. | |
buyQuantity | number | No | Purchase quantity. It is required when "mode" is game. See buyQuantity Limit for details. | |
zoneId | string | 1 | No | Region ID |
success | function | No | The callback function for a successful API call | |
fail | function | No | Callback function for failed API call | |
complete | function | No | Callback function used when API call completed (always executed whether call succeeds or fails) |
Valid values of object.mode
Value | Description | Minimum Version |
---|---|---|
game | Purchase game currency |
Valid values of object.env
Value | Description | Minimum Version |
---|---|---|
0 | Official environment of MIDAS | |
1 | Sandbox environment of MIDAS |
Valid values of object.currencyType
Value | Description | Minimum Version |
---|---|---|
CNY | Renminbi |
Valid values of object.platform
Value | Description | Minimum Version |
---|---|---|
android | android |
# Errors
Error Code | Error Message | Description |
---|---|---|
-1 | System failure | |
-2 | Payment canceled | |
-15001 | Virtual payment API error code. Missing parameters. | |
-15002 | Virtual payment API error code. Invalid parameters. | |
-15003 | Virtual payment API error code. Order duplication. | |
-15004 | Virtual payment API error code. Backend error. | |
-15006 | Virtual payment API error code. The appId authorization is suspended. | |
-15006 | Virtual payment API error code. The currency type is not supported. | |
-15007 | Virtual payment API error code. The order has been paid. | |
1 | Virtual payment API error code. The user canceled payment. | |
2 | Virtual payment API error code. Client error: it is detected that another payment request is initiated by the Mini Program when the user is already in the payment. | |
3 | Virtual payment API error code. An error specific to Android: the user chose to pay with GooglePlay, but GooglePlay was not installed on the mobile phone. | |
4 | Virtual payment API error code. Unusual payment status with the user's operating system. | |
5 | Virtual payment API error code. Operating system error. | |
6 | Virtual payment API error code. Other errors. | |
1000 | Parameter error | |
1003 | MIDAS Portal error |
# buyQuantity Limit
To purchase game currency, buyQuantity cannot be specified at will. The rule of "buyQuantity * unit price of game currency = limited price level" should be followed. For example, if the unit price of game currency is 0.1 CNY, the minimum quantity for one purchase is 10.
Effective price levels are as follows:
Price level (Unit: CNY) |
---|
1 |
3 |
6 |
8 |
12 |
18 |
25 |
30 |
40 |
45 |
50 |
60 |
68 |
73 |
78 |
88 |
98 |
108 |
118 |
128 |
148 |
168 |
188 |
198 |
328 |
648 |