3.Payment

3.1 Set payment callback

Android

PayNative.setPayResultCallback(new PayManager.PayCallback() {

    @Override
    public void onPayFinish(PayParams params) {
        // TODO Auto-generated method stub
        switch (params.getPayResult()){
            //pay success
            case PayDef.PAY_RESULT_SUCCESS:
                break;
            //pay fail
            case PayDef.PAY_RESULT_FAIL:
                break;
            //cancel pay
            case PayDef.PAY_RESULT_CANCEL:
                break;
        }
    }

    @Override
    public void onInitPayAgentFinish(BasePayAgent arg0) {
        // TODO Auto-generated method stub

    }
});

Callback Method Description:

onPayFinish:Payment Result Callback

  • payParams:Payment related parameters (payment result, billing ID and other information can be obtained through this parameter)

onInitPayAgentFinish:Payment method initialized success

iOS

3.2 Does the market support exit?(only Android)

Android(Necessary)

Unity

3.3 Get payment button type

Android

iOS

Unity

3.4 Get the market type

Android

iOS

Unity

3.5 Get package control information

Android

iOS

Unity

parameter:

  • ctrl:Control parameter

Return value:

Control parameter

Description of control parameters:

number

package name

Pop-up rules

1

Beginner's gift package

Pop up if you haven't bought a novice gift bag when entering the game Homepage

2

Quick rush

Pop up when user virtual currency is insufficient

3

Limited time gift package

When entering the game homepage, if you have bought a novice gift bag, it will pop up

4

Clearance Award

Pop up when passing the Checkpoint

5

VIP gift package

Pop up when entering the level selection page

6

Today's deal

Button trigger

7

Affordable package

Button trigger

8

Shopping Mall

Button trigger

3.6 Call payment

Android

If you want to use WeChat payment, you need to put feedata_wx.xml in the assets directory. If you want Alipay, you need to put feedata_alipay.xml

iOS

Unity

example:

parameter:

  • id:Billing points defined in the gameid

  • price:The price of the billing point, in minutes.

  • payType:Payment type specified。eg:PayDef.PAY_TYPE_MM

  • userdata:User defined data

  • callFun:Payment callback(only Unity)

3.7 Repay props

iOS

3.7 Need more game buttons

Android

Unity

3.8 Open more games

Android

Unity

3.9 Jump to an app details page in the store

Android

iOS

parameter:

  • appid:Appid of jump APP

Unity

parameter:

  • package:The name of APP package in Android platform and app ID in IOS platform

3.10 Jump to the store details page of the current app

Android

iOS

Unity

最后更新于

这有帮助吗?