# Virtual Payment

The Games provide developers with in-game virtual item purchase services.

Note: At present, the Mini Game Virtual Payment is only supported in the Android system, and not open yet in the Apple iOS system.

# Before Opening the Virtual Payment, Developers Need to Complete:

  1. Open Mini Program WeChat Pay
  2. Apply to open Mini Game Virtual Payment

wx.requestMidasPayment() is our API for buying game coin:

wx.requestMidasPayment(Object options)

At this stage, we support the configuration of following price grades. For details, please see the limit description about buyQuantity in wx.requestMidasPayment().

Price Grade (unit: RMB yuan)
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

# Sample Code

// Game Coin
wx.requestMidasPayment({
    mode: 'game',
    offerId: '',
    buyQuantity: 10,
    zoneId: 1,
    success() {
        // Payment succeeded
    },
    fail({ errMsg, errCode }) {
        // Payment failed
        console.log(errMsg, errCode)
    }
})

In addition, we provide a sandbox provide a sandbox test environment for test validation and debugging, and provide following APIs accordingly:

Interface Name Features Instructions
midasGetBalance Check Balances View a user's game coin balance
midasPay Deduct Game Coins Deduct a user’s game coins
midasCancelPay Payment Cancellation Orders for the deduction of game coins within the validity period can be canceled through this interface.
midasPresent Game Coins Gift Give a user a game coin

For the signature algorithm, please refer to [MidasPay Signature]((MidasPay Signature))

点击咨询小助手