SlideShare a Scribd company logo
Chromeウェブストア
Chromeウェブストア - Html5とか勉強会42
• Hostedアプリ
– Webサーバから必要なファイルが提供される
• Packagedアプリ
– 必要なファイル群がChromeにインストールさ
れる
• 拡張機能
– Chromeに便利な機能を追加する
The Chrome Web Store lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
開発者
ユーザー
登録
The Chrome Web Store lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
開発者
ユーザー発見
開発者
ユーザー発見
利用
The Chrome Web Store lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
開発者 ユーザー
開発者 ユーザー
決済機能の
開発が必要
開発者
ユーザー
開発者
ユーザー
種別 アプリでの利用 拡張機能での利用
アプリ自体の販売
(1回、定期購入)
○ ×
アプリ内課金
(デジタルグッズなどの販
売) ○ ○
広告の掲載
○ ○
アプリ自体の販売
・・・Chromeウェブストア決済
Chromeウェブストア - Html5とか勉強会42
Chromeウェブストア - Html5とか勉強会42
• 1回払い
• 月間登録料
• 年間登録料
• 無料試用版
Chromeウェブストア - Html5とか勉強会42
Chromeウェブストア - Html5とか勉強会42
Chromeウェブストア - Html5とか勉強会42
Chromeウェブストア - Html5とか勉強会42
無料試用版
• Hostedアプリ
– Licensing API
• Packagedアプリ
– 機能制限版とフル機能版の2つをリリース
Chromeウェブストア - Html5とか勉強会42
Licensing API
• OpenID認証を行う
• ライセンスサーバにリクエストを送る
• 購入状況によって機能を制限する
https://www.googleapis.com
/chromewebstore/v1/licenses/[AppId]/[UserID]
https://www.googleapis.com
/chromewebstore/v1/licenses/[AppId]/[UserID]
+ 署名
# 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)
{
"kind": "chromewebstore#license",
"id": "appId/userId",
"appId": "appId",
"userId": "userId",
"result": "YES",
"accessLevel": "FULL",
"maxAgeSecs": "3600",
}
result値 accessLevel値 状況
YES FULL ユーザーはアプリに課金している。
YES FREE_TRIAL ユーザーはアプリに課金してなく、
無料試用版を使うべき。
NO NONE ユーザーはアプリに課金してなく、
アプリにアクセスしていない。
アプリ内課金
・・・Google In-App Payments API for Web
開発者のサーバ
星を手に入れる
購入
①
②
APIコール
③
Googleのサーバ 開発者のサーバ
通知
④
通知
⑤
星を手に入れた!
⑥
JWTの生成
{
"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"
}
}
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)
eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.ey
Jpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzO
DAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19y
b290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1
p1r_wW1gFWFOEjXk
開発者のサーバ
星を手に入れる
購入
①
②
APIコール
③
Googleのサーバ 開発者のサーバ
通知
④
通知
⑤
星を手に入れた!
⑥
buy()関数の
呼び出し 購入画面
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('payments', '1.0', {
'packages': ['sandbox_config']
});
</script>
var generatedJwt = ...;
document.getElementById("buy").onclick = function(evt) {
purchase();
};
function purchase() {
...
goog.payments.inapp.buy({
jwt: generatedJwt,
success: function(result) { ... },
failure: function(result) { ... }
});
}
Chromeウェブストア - Html5とか勉強会42
開発者のサーバ
星を手に入れる
購入
①
②
APIコール
③
Googleのサーバ 開発者のサーバ
通知
④
通知
⑤
星を手に入れた!
⑥
ポストバック
URLの呼び出
し
{
"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"
}
}
SELLER_SECRET = '販売者の秘密鍵'
encoded_jwt = params['jwt']
item_token = JWT.decode(encoded_jwt, SELLER_SECRET)
order_id = item_token['response']['orderId']
# デコードされた内容に基づいて、注文内容を確認し、
# 必要があればデータベースに注文完了を書き込む
render text: order_id
開発者のサーバ
星を手に入れる
購入
①
②
APIコール
③
Googleのサーバ 開発者のサーバ
通知
④
通知
⑤
星を手に入れた!
⑥
コールバック
関数の呼び出
し
Chromeウェブストア - Html5とか勉強会42
var generatedJwt = ...;
document.getElementById("buy").onclick = function(evt) {
purchase();
};
function purchase() {
...
goog.payments.inapp.buy({
jwt: generatedJwt,
success: function(result) { ... },
failure: function(result) { ... }
});
}
• Hostedアプリ
– Available.
• Packagedアプリ
– Can use on the dev channel.
Tax
付加価値税
• 購入するユーザーと開発者の直接契約
– 納税する責任は開発者にある
Chromeウェブストア - Html5とか勉強会42
Chromeウェブストア - Html5とか勉強会42
国ごとに法律が異なる
• 税率の違い
• 購入者が国外にいた時の扱い
• 納税免除の下限額の違い
・・・知らなかった、では済まされない
• 田中 洋一郎
– Google Developers Expert (Chrome)
– LINE株式会社 開発1センター所属
End

More Related Content

PPT
Search Engine Marketing: How Insurance Agents Can Take Advantage
PPT
2008 09 Grandparents Day
PPTX
Info scoop opensource
PPT
Sun Tech Days 2007 Mash up
PPT
Prakash Belawadi - Manifesto BBMP 2010 elections
PDF
St. Anthony's Catholic School Field Day 2008
PPTX
みんなの知らないChrome appsの世界
PPT
Search Engine Marketing: How Insurance Agents Can Take Advantage
Search Engine Marketing: How Insurance Agents Can Take Advantage
2008 09 Grandparents Day
Info scoop opensource
Sun Tech Days 2007 Mash up
Prakash Belawadi - Manifesto BBMP 2010 elections
St. Anthony's Catholic School Field Day 2008
みんなの知らないChrome appsの世界
Search Engine Marketing: How Insurance Agents Can Take Advantage

Similar to Chromeウェブストア - Html5とか勉強会42 (7)

PDF
オンラインゲームソリューション@トレジャーデータ
PDF
Firefox Marketplace and Payment
PPTX
XOOPS EC Distribution
PDF
初めての Data api cms どうでしょう - 大阪夏の陣
PDF
SocialWeb Conference vol.5 OpenSocial Night #2
PDF
Google Play Game Servicesについて
PDF
Data apiで実現 進化するwebの世界
オンラインゲームソリューション@トレジャーデータ
Firefox Marketplace and Payment
XOOPS EC Distribution
初めての Data api cms どうでしょう - 大阪夏の陣
SocialWeb Conference vol.5 OpenSocial Night #2
Google Play Game Servicesについて
Data apiで実現 進化するwebの世界
Ad

More from Yoichiro Tanaka (12)

PPTX
Navigate users from assistant app to android app
PPTX
Chrome Extensionsの基本とデザインパターン
PPTX
Chrome Extensionsから見るWebExtensions
PDF
SocialWeb-Japan Vol.2 20090428
PPT
JRuby on Rails
PPT
JavaEdge第3回ライブセッション
PPT
maven2+aptで楽々ドキュメント
PPT
丸山先生レクチャーシリーズ2007-2008
PPT
体操競技のルール改正と今後の日本の方向性
PPT
Wicket勉強会2
PPS
世間の荒波を乗りこなせ!
Navigate users from assistant app to android app
Chrome Extensionsの基本とデザインパターン
Chrome Extensionsから見るWebExtensions
SocialWeb-Japan Vol.2 20090428
JRuby on Rails
JavaEdge第3回ライブセッション
maven2+aptで楽々ドキュメント
丸山先生レクチャーシリーズ2007-2008
体操競技のルール改正と今後の日本の方向性
Wicket勉強会2
世間の荒波を乗りこなせ!
Ad

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