Android 遊戲的開發者在提供遊戲內購買的功能時都要面對的問題:如何驗證 In-app Billing 電子收據,網路上
可以找到不少的方法可以繞過 Android In-app Billing 的驗證,用 Fake IAB receipt 欺騙我們開發的 Android 遊戲。
要防治這個問題最簡單的方式就是將 IAB receipt 向 Google Play 進行驗證,下圖(臨時用 Google 文件畫的)是我們
製作的遊戲在遊戲內購買功能的流程,因採用負載平衡所以登入的動作會多二個步驟,整個流程大致如下︰
1.登入Master Server
2.Master Server回傳負載最輕的伺服器
3.連線到遊戲伺服器
4.Client 發送儲值要求 要Game Server
5.Game Server回傳我方的訂單編號給 Client
6.Client 向 Google Play 請求儲值
7.Google Play 回傳交易憑證到 Client
8.Client 要求結束儲值並將交易憑證給 Game Server
9.Game server 向 Google Play 驗證交易憑證
10.Google Play 回報交易結果
11.Game Server 通知儲值結果給 Client
可以找到不少的方法可以繞過 Android In-app Billing 的驗證,用 Fake IAB receipt 欺騙我們開發的 Android 遊戲。
要防治這個問題最簡單的方式就是將 IAB receipt 向 Google Play 進行驗證,下圖(臨時用 Google 文件畫的)是我們
製作的遊戲在遊戲內購買功能的流程,因採用負載平衡所以登入的動作會多二個步驟,整個流程大致如下︰
1.登入Master Server
2.Master Server回傳負載最輕的伺服器
3.連線到遊戲伺服器
4.Client 發送儲值要求 要Game Server
5.Game Server回傳我方的訂單編號給 Client
6.Client 向 Google Play 請求儲值
7.Google Play 回傳交易憑證到 Client
8.Client 要求結束儲值並將交易憑證給 Game Server
9.Game server 向 Google Play 驗證交易憑證
10.Google Play 回報交易結果
11.Game Server 通知儲值結果給 Client

App 若只做到第7個步驟時就會將玩家儲值或購買的東西給玩家時,就能被 Fake IAB receipt 所斯騙。
要進行第8個步驟前需要先到 Google Play 的管理中心進行設定,登入 Google Play Developer Console 必須是帳戶擁有者才可以進行設定,接到到設定 -> API 存取權的頁面,接著點擊建立新專案
要進行第8個步驟前需要先到 Google Play 的管理中心進行設定,登入 Google Play Developer Console 必須是帳戶擁有者才可以進行設定,接到到設定 -> API 存取權的頁面,接著點擊建立新專案

連著會建立好專案之後再點擊建立OAuth用戶端之後會轉到 Google Console

緊接著再點擊 Create new Client ID(看你使用的Browser的語系而定,繁中版會顯示中文)

接著選第二種 Server account

建立好之後會出現下面的資訊,過程中會下載一個 p12 憑證檔案,請保存好,此外再記好 EMAIL ADDRESS 下篇會用到。

接著點擊左方選單的 APIs 將 Google Play Android Developer API 開啟

最後一步,必需將剛建立的帳號給予管理員的權限才行。

透過上述的設定之後,接下來我們就可以在遊戲伺服器內用剛才建立的 Server Account 向 Google Play 進行交易憑證的驗證,
防止收到 Fake IAB receipt 時仍將點數或道具交給玩家。
防止收到 Fake IAB receipt 時仍將點數或道具交給玩家。
沒有留言:
張貼留言