More Related Content
PPT
Search Engine Marketing: How Insurance Agents Can Take Advantage PPT
PPTX
PPT
Sun Tech Days 2007 Mash up PPT
Prakash Belawadi - Manifesto BBMP 2010 elections PDF
St. Anthony's Catholic School Field Day 2008 PPTX
PPT
Search Engine Marketing: How Insurance Agents Can Take Advantage Similar to Chromeウェブストア - Html5とか勉強会42
PDF
PDF
Firefox Marketplace and Payment PDF
Chrome Apps & Chromeウェブストア概要 PDF
appengine ja night #10 Google AppEngine で作る Google Apps Marketplace 対応サービス PDF
Amazon product advertising apiで遊んでみた PDF
Google Apps Marketplace Billing API概要 PDF
PDF
PDF
PDF
PPTX
PDF
PPT
素敵なjavascript ~google chrome編~ KEY
More from Yoichiro Tanaka
PPTX
Navigate users from assistant app to android app PPTX
Chrome Extensionsの基本とデザインパターン PPTX
Chrome Extensionsから見るWebExtensions PDF
PDF
SocialWeb-Japan Vol.2 20090428 PPT
PPT
PPT
PPT
PPT
PPT
PPS
Chromeウェブストア - Html5とか勉強会42
- 1.
- 3.
- 4.
The Chrome WebStore lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
- 5.
- 6.
The Chrome WebStore lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
- 7.
- 8.
- 9.
The Chrome WebStore lets you
publish apps and games – either free
or paid – where Google Chrome users
can easily find them.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 18.
- 23.
- 24.
- 26.
- 27.
- 28.
- 29.
# 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)
- 30.
- 31.
- 32.
- 33.
- 34.
{
"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"
}
}
- 35.
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)
- 36.
- 37.
- 38.
- 39.
var generatedJwt =...;
document.getElementById("buy").onclick = function(evt) {
purchase();
};
function purchase() {
...
goog.payments.inapp.buy({
jwt: generatedJwt,
success: function(result) { ... },
failure: function(result) { ... }
});
}
- 41.
- 42.
{
"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"
}
}
- 43.
SELLER_SECRET = '販売者の秘密鍵'
encoded_jwt= params['jwt']
item_token = JWT.decode(encoded_jwt, SELLER_SECRET)
order_id = item_token['response']['orderId']
# デコードされた内容に基づいて、注文内容を確認し、
# 必要があればデータベースに注文完了を書き込む
render text: order_id
- 44.
- 46.
var generatedJwt =...;
document.getElementById("buy").onclick = function(evt) {
purchase();
};
function purchase() {
...
goog.payments.inapp.buy({
jwt: generatedJwt,
success: function(result) { ... },
failure: function(result) { ... }
});
}
- 47.
- 48.
- 49.
- 52.
- 53.
• 田中 洋一郎
–Google Developers Expert (Chrome)
– LINE株式会社 開発1センター所属
- 54.