Saturday, December 10, 2011

[Android in-app billing前言]In-app Billing應用程式內部付費機制(中文翻譯)

2011/12/10:
雖然臺北市政府和Google 7天退費乙事讓台灣Android使用者無法合法購買產品,
但最近因為工作上的需要,
再次被要求先前不穩定的in-app Billing是否能正常消費不受影響,
結果這個答案是肯定的
完全不需要使用者ROOT或者設VPN,
就能直接消費。

臺灣Android市集禁止銷售付費軟體,
我深受其害,
我知道有許多臺灣區開發者想快點找到其它賺錢獲利方式,
而非僅靠廣告。

之前我曾試著將應用程式內金流機制重點寫出來,
由於安全性邏輯太過龐大,
我完全無法簡言之。

希望英文比我更好的人,
能對於我翻譯不好的地方加以建議並糾正。
這是好事一件~

接著我將盡我所能將龐大而且繁瑣的In-app Billing機制翻譯出來。

2011/12/25:
聖誕夜聽到4~5臺消防車警報聲從窗外傳來,
這個平安夜有人似乎不太平安呢!
願他們一切安好。

呼~經過15天不眠不休的努力,
終於把7大篇應用程式內部金流機制初版全數翻譯完成。

我知道有些地方翻譯的不好,
但是對於那些英文很差的人來說,
我相信絕對是有幫助的。

請大家幫忙,給些意見,
讓這些譯文更好。
===========================

應用程式內付費機制

原文連結︰In-app Billing
翻譯︰小鰻
翻譯版本號︰v.1.0
如需轉載請註明出處「小鰻的Android學習筆記
讓我參與最直接的討論以及錯誤修正, 謝謝!

Android Market In-app Billing is an Android Market service that lets you sell digital content in your applications. You can use the service to sell a wide range of content, including downloadable content such as media files or photos, and virtual content such as game levels or potions.

Android市集的應用程式內付費機制(In-app Billing,以下簡稱iap)是Android市集的一項服務,讓你能夠在應用程式內銷售你的數位化內容。你可以用這項服務銷售任何的內容,包括可下載的內容(像是多媒體檔案或照片)、虛擬內容(遊戲等級或藥劑)

When you use Android Market's in-app billing service to sell an item, Android Market handles all checkout details so your application never has to directly process any financial transactions. Android Market uses the same checkout service that is used for application purchases, so your users experience a consistent and familiar purchase flow (see figure 1). Also, the transaction fee for in-app purchases is the same as the transaction fee for application purchases (30%).

當你開始使用Android市集的iap服務銷售商品時,Android市集處理了所有的付款項目,因此你的應用程式完全沒有直接的交涉到財務相關的交易。Android市集使用了同一套付款服務來讓程式能夠購買商品,所以你的使用者會有一套像圖1相似的使用經驗。並且,在這裡要說明的是,iap的服務費和市集銷售的服務費是一樣的(皆為30%抽成)。

Any application that you publish through Android Market can implement in-app billing. No special account or registration is required other than an Android Market publisher account and a Google Checkout Merchant account. Also, because the service uses no dedicated framework APIs, you can add in-app billing to any application that uses a minimum API level of 4 or higher.

任何經過Android市集發佈的APP都能夠使用iap,完全不需要做任何的其它設定,像是又註冊一組Android Market publisher帳戶或Google Checkout Merchant帳戶。更好的消息是︰由於這項服務並沒有指定在APIs架構中,因此你可以在level 4(Android1.5)或以上的任何APP上使用。

To help you integrate in-app billing into your application, the Android SDK provides a sample application that demonstrates a simple implementation of in-app billing. The sample application contains examples of billing-related classes you can use to implement in-app billing in your application. It also contains examples of the database, user interface, and business logic you might use to implement in-app billing.

為了幫助你將iap機制整合進你的APP裡,Android SDK提供了一個範例程式來說明如何簡單的實作iap機制。範例APP包含了和付費機制相關的類別們,你可以拿進你的APP裡來實作並使用。這個範例裡也包含了資料庫的範例、使用者介面和你也許會拿來實作使用的應用程式付費商業邏輯。

Important: Although the sample application is a working example of how you can implement in-app billing, we strongly recommend that you modify and obfuscate the sample code before you use it in a production application. For more information, see Security and Design.

重要︰雖然範例裡能正常運作應用程式內部付費機制,我們在此強烈的建議你修改而且混淆範例的程式碼 ,由其在你開始使用他們進你的APP產品前。更多的內容,請參見Security and Design這篇文章。

 Figure 1. Applications initiate in-app billing requests through their own UI (first screen). Android Market responds to the request by providing the checkout user interface (middle screen). When checkout is complete, the application resumes.

圖1.應用程式透過開發者自己設計的介面來請求並使用iap機制(第一張)。Android市集回應傳來的請求,並且提供付費介面(中間)。當付費完成時,就會呼叫application的onResume(),見右圖。

To learn more about Android Market's in-app billing service and start integrating it into your applications, read the following documents:

若要學習並了解更多的Android市集iap服務機制並且整合進您的APP,請參閱下列的文件︰

Overview of In-app Billing應用程式內部付費機制概述[原文][中譯]
Learn how the service works and what a typical in-app billing implementation looks like.
這章裡可以學到應用程式內部金流服務是如何運作的,並且可以看到實作應用程式內部金流機制的典型樣式為何 。
Implementing In-app Billing實作應用程式內部金流機制[原文][中譯]
Use this step-by-step guide to start incorporating in-app billing into your application.
藉由一步一步的引導,將應用程式內部金流機制整合進您的APP裡 。
Security and Design安全與設計[原文][中譯]
Review these best practices to help ensure that your in-app billing implementation is secure and well designed.
檢視這些相當棒的練習來幫助您實作iap機制出來的APP更加的安全,也有更好的設計。
Testing In-app Billing測試應用程式內金流機制[原文][中譯]
Understand how the in-app billing test tools work and learn how to test your in-app billing implementation.
了解應用程式內部金流測試工具是如何運作,並且學習如何測試您實作出來的iap機制。
Administering In-app Billing應用程式內金流機制的管理[原文][中譯]
Learn how to set up your product list, register test accounts, and handle refunds.
學習如何設定您的產品列表、註冊測試帳戶和處理退款的問題。
In-app Billing Reference應用程式金流的相關API[原文][中譯]
Get detailed information about Android Market response codes and the in-app billing interface.
這篇能獲得關於Android Market回應碼(response codes)和應用程式內部金流接口的詳細資訊。

相關文章︰
1.[Android in-app billing前言]In-app Billing應用程式內部付費機制(中文翻譯)
2.[Android in-app billing第1篇]In-app Billing Overview應用程式內部付費機制概述(中文翻譯)
3.[Android in-app billing第2篇]Implementing In-app Billing實作應用程式內部金流機制(中文翻譯)
4.[Android in-app billing第3篇]Security and Design安全與設計(中文翻譯)
5.[Android in-app billing第4篇]Testing In-app Billing測試應用程式內金流機制(中文翻譯)
6.[Android in-app billing第5篇]Administering In-app Billing應用程式內金流機制的管理(中文翻譯)
7.[Android in-app billing第6篇(末)]In-app Billing Reference應用程式金流的相關API(中文翻譯)
8.[Android in-app billing筆記]串接Google play in-app billing易犯的錯誤 

3 comments:

阿法貝塔 said...

想請問一下,如果想直接用這個sample app來測,除了要更改PublicKey並把sample app上到market上面(沒發佈)並把應用程式內產品清單的商品給發佈,除了以上外,還有需要更改的地方嗎?
我目前遇到的Response Codes是RESULT_DEVELOPER_ERROR

Unknown said...

上架的APP不需要發佈,
但是iap商品要發佈出去。
另外,在Android publisher的profile裡,
也要將測試帳號加入,
Google才知道是哪個帳號要拿來測試。
另外,在官方文檔提到會收到RESULT_DEVELOPER_ERROR的原因︰Indicates that an application is trying to make an in-app billing request but the application has not declared the com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed, or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.
會收到這個回應值主要是因為程式目前試圖對一個沒有在AndroidManifest.xml裡宣告com.android.vending.BILLING權限的程式做應用程式購買請求,也有可能是簽章不對,甚至可能是發出一個異常請求,像是Bundle裡沒有給key值或者發出了一個Android市集無法辨識的請求型態。

詳細內容,請參見In-app Billing Reference那篇介紹。

Unknown said...

我叫子軒,希望可以認識您,請問您有 line 嗎?這是我的line id : thehandsome369