Youmi android offers order callback protocol en

来自有米广告开发者WIKI
跳转至: 导航搜索

Youmi Android OfferWall Server Callback Protocol

Statement

  • This document is used for Android platform. For iOS platform, please refer to here:iOS Rewarded Offerwall Server Callback Interface
  • The uniform encoding of interface: UTF-8
  • Be suited to developers who use their own server to manage currency points.
  • Once Youmi gets the feedback data from advertisers, we will report back to developers' server immediately.
  • It will need developers to offer an interface to receive data. The method for interface to receive data: GET.


Procedure

  1. evelopers will set up the currency points feedback address in Youmi's developer background control panel, eg: https://www.youmi.net/apps/setting
  2. Once Youmi's server receives an effective data record, it will feedback to developers' server (with GET method) with the feedback url address which is offered by developers. Relevant parameters will be will plus to the url address as below.


Parameters

Full Name Brief Name Type Statement
Order ID order string(18 bytes) Order ID: This value is unique. If developer receives the same order ID, that means the order is already existed.
App ID app string(16 bytes) The Application ID
Ad Name ad string(50 bytes) The advertisement name. If the ad type is app, then the ad name is the application's name
User ID user string(256 bytes) User ID: Developers can set up their own user ID. For example, if developers' apps have the login function, then user ID can be used to replace the CID identification which is offered by Youmi. (Youmi will generate an identification number for each device) Otherwise, Youmi will use CID as user ID. <br/Notes: The parameters and processed by urlencode. Please use urldecode to acquire the original parameters.
Channel chn int Channel ID
Points points int The currency points that users can earn.
If this value is 0, that means user won't get the currency points due to some reasons. For example, users already exceed the limited activation number.
Signature sig string(8 bytes) Parameters signature, the signature algorithm as below.
This value is used for verify the integrity of the above parameters, to prevent the third party to tamper with them.

The parameters which are not involved in signature:

Full Name Brief Name Type Statement
Adid adid int Advertisement ID
Package Name pkg String App Package Name
Device ID device string Device ID:imei for android
Notes: The parameters and processed by urlencode. Please use urldecode to acquire the original parameters.
Time time int The time when have an affect
Price price float The revenue can be obtained by the application


Signature Algorithm

php:

$sig = substr(md5($dev_server_secret . "||" . $order . "||" . $app . "||" . $user . "||" . $chn . "||" . $ad . "||" . $points), 12, 8);

java:

String sig = md5(dev_server_secret + "||" + order + "||" + app + "||" + user + "||" + chn + "||" + ad + "||" + points).substring(12, 20);

c#:

String input=dev_server_secret + "||" + order + "||" + app + "||" + user + "||" + chn + "||" + ad + "||" + points;
byte[] buff=Encoding.UTF8.GetBytes(input);
String sig = md5(buff).Substring(12, 8);

Notes:

  1. $dev_server_secret: The secret key from developers' server, offered by Youmi. Enter this page "http://www.youmi.net/apps/setting" after logging, find the rewarded ads callback method setting-server callback setting, and set up the server address. After successfully setting, a secret key will be assigned to your app.
    , you can inquire the key in the developers back end control panel.
  2. $order: The parameter order in interface, like the others parameters.
  3. $user、$ad、$device:It is the original parameters which are involved in signature. It will use urlencode when transferring. So you should use original parameters when verifying sig.


Verification of signature parameters

Statements:In the early stage of integrating advertisement SDK, developers might find it fail to pass the verification, then this verification interface will be needed to verify. 
Of course, you can also contact our customer service directly. Normal verification logic will be implemented by developers themselves.

Supposed that developers receive the feedback request from Youmi is:

http://api.kaifazhe.com/youmi.php?order=YM130402cygr_UTb42&app=30996ced018a2a5e&ad=KC%E7%BD%91%E7%BB%9C%E7%94%B5%E8%AF%9D&user=1141058&device=50ead626ae6e&chn=0&points=7&time=1364890524&sig=15b3dfe0&adid=100&pkg=abc

Just replace the prefix http://api.kaifazhe.com/youmi.php with http://aos.wall.youmi.net/v2/check_fb_sig and do some tests:

http://aos.wall.youmi.net/v2/check_fb_sig?order=YM130402cygr_UTb42&app=30996ced018a2a5e&ad=KC%E7%BD%91%E7%BB%9C%E7%94%B5%E8%AF%9D&user=1141058&device=50ead626ae6e&chn=0&points=7&time=1364890524&sig=15b3dfe0&adid=100&pkg=abc


Return Value

  1. Youmi will proceed the next operation according to the returning http status code from developers' server. The normal http status code should be 200 or 403.
  2. If the http status code is 200, that means developers already received and processed the message normally.
  3. If the http status code is 403, that means developers refuse this request, which also means middle-tier server will not repeatedly make request to developers' server.
  4. If timeout, or the http status code isn't one of 2xx, 301, 302, 303, 307, 400 and 403, the middle-tier server will make request to developers' server again in the next cycle.
  5. There will be delays in the next cycle request to developers' server, the delay time will respectively be: 5s, 10s, 60s, 300s, 600s, 3600s(since last request). Which means, in the worst case, Youmi will send seven requests. If all of the seven requests fail, the link will be discarded.
  6. Because of network issues or other reasons, developers' server will receive multiple records with the same order ID. In this case, developers' server need to abandon the duplicate records, and output with http status code 403.