Program Interfaces

Attention: Only when the logout method is called, can there be indicators such as game duration and active users. The core design of a complete session link has three steps:

  1. init
  2. login
    Any consumption and custom events
  3. logout

Program Interfaces include Player Login, Payment Behavior Analysis, Custom Events.

Player Login

// login start (parameter: channel)
[CAAccount loginStart:@"channel_name"];

// login successful (parameter: user ID)
[CAAccount loginSuccess:@"usedid_xxx" age:0 sex:0 channel:@"channel_name"];
// channel customer acquisition channel, refers to obtaining information about the client's advertising channels   
// login failed (parameter: the cause of failure)
[CAAccount loginFailed:@"wrong password"];

// logout  (We have considered and improved the abnormal logout operation of players)
[CAAccount logout];

Payment Behavior Analysis

Not an actual payment channel. Only used to collect payment behavior.

// payment start
[CAPayment payBegin:@"1000"             // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
            orderID:@"1943946387"       // Order ID, which uniquely identifies a transaction.
            payType:@"wechat"           // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
          subjectID:@"pack of 600 coins"         // Item ID. The type of topping up package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies
       currencyType:@"CNY"              // Topping up currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types. 
virtualCurrencyAmount:@"1000"           // The amount of virtual currency obtained by topping up.
          accountID:@"wechat_userid"    // consumer account. Apple is AppleID, Android is Google Advertising ID, etc.
            partner:@"payment channel"          // payment channel
         gameServer:@"server-100"       // The server where the player tops up.
              level:@"1"                // The level at which the player tops up.
            mission:@"Join Diamond VIP"       // The level or mission where the player tops up. You can also input a player's highest level.
];

// payment successful
[CAPayment paySuccess:@"1000"           // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
              orderID:@"1943946387"
              payType:@"wechat"
            subjectID:@"pack of 600 coins"
         currencyType:@"CNY"
virtualCurrencyAmount:@"1000"
            accountID:@"wechat_userid"
              partner:@"payment channel"
           gameServer:@"server-100"
                level:@"1"
              mission:@"join diamond vip"
];

// payment failed
[CAPayment payFailed:@"1000"            // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
              orderID:@"1943946387"
              payType:@"wechat"
            subjectID:@"pack of 600 coins"
         currencyType:@"CNY"
virtualCurrencyAmount:@"1000"
            accountID:@"wechat_userid"
              partner:@"payment channel"
           gameServer:@"server-100"
                level:@"1"
              mission:@"join diamond vip"
               reason:@""               // the cause of topping up failure
];

// payment canceled
[CAPayment payCanceled:@"1000"          // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
              orderID:@"1943946387"
              payType:@"wechat"
            subjectID:@"pack of 600 coins"
         currencyType:@"CNY"
virtualCurrencyAmount:@"1000"
            accountID:@"wechat_userid"
              partner:@"payment channel"
           gameServer:@"server-100"
                level:@"1"
              mission:@"join diamond vip"
];

Custom Events

The event ID can be filled in arbitrarily, and the event content and label can be customized. E.g:

"evetID":"barrier",
"eventValue":{
        "number of the level" : "magic bottle",
        "player level" : "100",
        "player power" : 100,
        "resurrection time" : 100,
        }

Length Limit: eventid (event ID) 200; tagkey (tag ID) 200; tagvalue (tag value) 200.

In the example above: barrier is eventID; number of levels is the tagkey; magic bottle is the tagvalue.

Custom events have built-in default templates, including player information, levels, missions (tasks), items, etc. Attention: Event ID cannot use keywords like: init, pay, task, barrier, item, advertising, role, virtual, to avoid confusion with the data of default templates.

// event start
[CACustomEvent onStarted:@"battle"
               eventData: @{
                           @"life": @"1000",
                           }
];

// event completed
[CACustomEvent onSuccess:@"battle"
               eventData: @{
                           @"life": @"1000",
                           }
];

// event canceled
[CACustomEvent onCancelled:@"battle"
                 eventData: @{
                             @"life":@"1000",
                             }
];

// event failed
[CACustomEvent onFailed:@"battle"
              eventData: @{
                          @"life": @"1000",
                          }
                 reason:@"battle canceled"
];

results matching ""

    No results matching ""