Advertisement

Chromeウェブストア - Html5とか勉強会42

Software Engineer at Increments, Inc.
Sep. 25, 2013
Advertisement

More Related Content

Advertisement

Recently uploaded(20)

Chromeウェブストア - Html5とか勉強会42

  1. Chromeウェブストア
  2. • Hostedアプリ – Webサーバから必要なファイルが提供される • Packagedアプリ – 必要なファイル群がChromeにインストールさ れる • 拡張機能 – Chromeに便利な機能を追加する
  3. The Chrome Web Store lets you publish apps and games – either free or paid – where Google Chrome users can easily find them.
  4. 開発者 ユーザー 登録
  5. The Chrome Web Store lets you publish apps and games – either free or paid – where Google Chrome users can easily find them.
  6. 開発者 ユーザー発見
  7. 開発者 ユーザー発見 利用
  8. The Chrome Web Store lets you publish apps and games – either free or paid – where Google Chrome users can easily find them.
  9. 開発者 ユーザー
  10. 開発者 ユーザー 決済機能の 開発が必要
  11. 開発者 ユーザー
  12. 開発者 ユーザー
  13. 種別 アプリでの利用 拡張機能での利用 アプリ自体の販売 (1回、定期購入) ○ × アプリ内課金 (デジタルグッズなどの販 売) ○ ○ 広告の掲載 ○ ○
  14. アプリ自体の販売 ・・・Chromeウェブストア決済
  15. • 1回払い • 月間登録料 • 年間登録料 • 無料試用版
  16. 無料試用版
  17. • Hostedアプリ – Licensing API • Packagedアプリ – 機能制限版とフル機能版の2つをリリース
  18. Licensing API • OpenID認証を行う • ライセンスサーバにリクエストを送る • 購入状況によって機能を制限する
  19. https://www.googleapis.com /chromewebstore/v1/licenses/[AppId]/[UserID]
  20. https://www.googleapis.com /chromewebstore/v1/licenses/[AppId]/[UserID] + 署名
  21. # Licensing APIのエンドポイント ENDPOINT = 'https://www.googleapis.com/chromewebstore/v1/licenses' # アプリID APP_ID = '...' # OAuthトークン OAUTH_TOKEN = '...' # OAuthトークンシークレット OAUTH_TOKEN_SECRET = '...' # ユーザーのOpenID URL文字列 user_id = ... # OAuthクライアントの生成 client = Signet::OAuth1::Client.new( :client_credential_key => 'anonymous', :client_credential_secret => 'anonymous', :token_credential_key => OAUTH_TOKEN, :token_credential_secret => OAUTH_TOKEN_SECRET ) # リクエストの送信 response = client.fetch_protected_resource( :uri => "ENDPOINT/#{app_id}/#{CGI::escape(user_id)}" ) # 結果の取得 result = JSON.parse(response.body)
  22. { "kind": "chromewebstore#license", "id": "appId/userId", "appId": "appId", "userId": "userId", "result": "YES", "accessLevel": "FULL", "maxAgeSecs": "3600", }
  23. result値 accessLevel値 状況 YES FULL ユーザーはアプリに課金している。 YES FREE_TRIAL ユーザーはアプリに課金してなく、 無料試用版を使うべき。 NO NONE ユーザーはアプリに課金してなく、 アプリにアクセスしていない。
  24. アプリ内課金 ・・・Google In-App Payments API for Web
  25. 開発者のサーバ 星を手に入れる 購入 ① ② APIコール ③ Googleのサーバ 開発者のサーバ 通知 ④ 通知 ⑤ 星を手に入れた! ⑥ JWTの生成
  26. { "iss": "購入者ID", "aud": "Google", "typ": "google/payments/inapp/item/v1", "exp": "1358678162", "iat": "1358674585", "request": { "name": "Red potion", "description": "It increases the hit point.", "price": "2.50", "currencyCode": "USD", "sellerData": "user_id:123,transaction_id:98765" } }
  27. SELLER_IDENTIFIER = '販売者 ID' SELLER_SECRET = '販売者の秘密鍵' token = JWT.encode( { 'iss' => SELLER_IDENTIFIER, 'aud' => 'Google', 'typ' => 'google/payments/inapp/item/v1', 'exp' => (Time.now + 3600).to_i, 'iat' => Time.now.to_i, 'request' => { 'name' => 'Red potion', 'description' => 'It increases the hit point.', 'price' => '2.50', 'currencyCode' => 'USD', 'sellerData' => 'user_id =>123,transaction_id =>98765' } }, SELLER_SECRET)
  28. eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.ey Jpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzO DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19y b290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1 p1r_wW1gFWFOEjXk
  29. 開発者のサーバ 星を手に入れる 購入 ① ② APIコール ③ Googleのサーバ 開発者のサーバ 通知 ④ 通知 ⑤ 星を手に入れた! ⑥ buy()関数の 呼び出し 購入画面
  30. <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('payments', '1.0', { 'packages': ['sandbox_config'] }); </script>
  31. var generatedJwt = ...; document.getElementById("buy").onclick = function(evt) { purchase(); }; function purchase() { ... goog.payments.inapp.buy({ jwt: generatedJwt, success: function(result) { ... }, failure: function(result) { ... } }); }
  32. 開発者のサーバ 星を手に入れる 購入 ① ② APIコール ③ Googleのサーバ 開発者のサーバ 通知 ④ 通知 ⑤ 星を手に入れた! ⑥ ポストバック URLの呼び出 し
  33. { "iss": "Google", "aud": "購入者ID", "typ": "google/payments/inapp/item/v1/postback/buy", "exp": "1358678162", "iat": "1358674585", "request": { "name": "Red potion", "description": "It increases the hit point.", "price": "2.50", "currencyCode": "USD", "sellerData": "user_id:12345,transaction_id:98765" }, "response": { "orderId": "3485709183457474939449" } }
  34. SELLER_SECRET = '販売者の秘密鍵' encoded_jwt = params['jwt'] item_token = JWT.decode(encoded_jwt, SELLER_SECRET) order_id = item_token['response']['orderId'] # デコードされた内容に基づいて、注文内容を確認し、 # 必要があればデータベースに注文完了を書き込む render text: order_id
  35. 開発者のサーバ 星を手に入れる 購入 ① ② APIコール ③ Googleのサーバ 開発者のサーバ 通知 ④ 通知 ⑤ 星を手に入れた! ⑥ コールバック 関数の呼び出 し
  36. var generatedJwt = ...; document.getElementById("buy").onclick = function(evt) { purchase(); }; function purchase() { ... goog.payments.inapp.buy({ jwt: generatedJwt, success: function(result) { ... }, failure: function(result) { ... } }); }
  37. • Hostedアプリ – Available. • Packagedアプリ – Can use on the dev channel.
  38. Tax
  39. 付加価値税 • 購入するユーザーと開発者の直接契約 – 納税する責任は開発者にある
  40. 国ごとに法律が異なる • 税率の違い • 購入者が国外にいた時の扱い • 納税免除の下限額の違い ・・・知らなかった、では済まされない
  41. • 田中 洋一郎 – Google Developers Expert (Chrome) – LINE株式会社 開発1センター所属
  42. End
Advertisement