Game8 Store – Developer Center
ホーム › 技術仕様 & API

シーケンス図

このページでは、アプリ外決済のシーケンスを図にまとめています。

ゲーム内アイテム購入

👤 ユーザーGame8 Storeゲーム(パブリッシャーAPI)決済システム👤 ユーザーGame8 Storeゲーム(パブリッシャーAPI)決済システム1. ゲーム内ユーザーID入力2. プレイヤー情報取得(GET /user_info)3. プレイヤー情報返却user_name, user_level4. プレイヤー名・レベル表示5. ゲーム内課金アイテム購入アイテム, 支払い情報, ポイント・クーポン決済金額(billing_amount)計算opt[ポイント・クーポンの利用がある場合]transaction_id 発番6. 購入可否チェック(GET /check)transaction_id, item, billing_amount年齢区分・購入上限・在庫を確認し、アイテム確保7. 確認結果返却result_code, purchasable8. 購入不可表示(result_code に応じたメッセージ)注文作成(status: pending)9. 決済実行支払い情報, 決済金額10. 決済結果返却決済ステータスopt[billing_amount が1円以上の場合]status: payment_confirmed11. 購入実績登録(POST /register)transaction_id, item, contents12. 注文照会(GET /orders/verify)paid_transaction_id13. 注文状態返却status(この時点ではpayment_confirmed)opt[パブリッシャーが注文状態を確認する場合]アイテム付与14. 登録結果返却result_code, item_granted購入結果登録(status: completed)15. 購入完了画面表示16. 購入通知メール送信17. 決済取消(返金)※決済した場合ポイント・クーポン返却・注文キャンセル(status: cancelled)18. 購入失敗表示alt[result_code が PUB0000][result_code が PUB0000 以外]alt[result_code が PUB0000 以外][result_code が PUB0000]
図のソース(mermaid)
sequenceDiagram
	autonumber
	actor user as ユーザー
	participant S8 as Game8 Store
	participant pub as ゲーム(パブリッシャーAPI)
	participant pay as 決済システム

	%% ゲーム内ID入力・プレイヤー確認
	user->>S8: ゲーム内ユーザーID入力
	S8->>+pub: プレイヤー情報取得(GET /user_info)
	pub->>-S8: プレイヤー情報返却
	note left of pub: user_name, user_level
	S8->>user: プレイヤー名・レベル表示

	%% 商品購入
	user->>S8: ゲーム内課金アイテム購入
	note right of user: アイテム, 支払い情報, ポイント・クーポン
	opt ポイント・クーポンの利用がある場合
	note over S8: 決済金額(billing_amount)計算
	end

	%% 購入可否チェック
	note over S8: transaction_id 発番
	S8->>+pub: 購入可否チェック(GET /check)
	note right of S8: transaction_id, item, billing_amount
	note over pub: 年齢区分・購入上限・在庫を確認し、アイテム確保
	pub->>-S8: 確認結果返却
	note left of pub: result_code, purchasable

	alt result_code が PUB0000 以外
	S8->>user: 購入不可表示(result_code に応じたメッセージ)
	else result_code が PUB0000
	note over S8: 注文作成(status: pending)
	opt billing_amount が1円以上の場合
	S8->>+pay: 決済実行
	note right of S8: 支払い情報, 決済金額
	pay->>-S8: 決済結果返却
	note left of pay: 決済ステータス
	end
	note over S8: status: payment_confirmed

	%% 決済成功後の即時通知
	S8->>+pub: 購入実績登録(POST /register)
	note right of S8: transaction_id, item, contents
	opt パブリッシャーが注文状態を確認する場合
	pub->>+S8: 注文照会(GET /orders/verify)
	note left of pub: paid_transaction_id
	S8->>-pub: 注文状態返却
	note right of S8: status(この時点では payment_confirmed)
	end
	note over pub: アイテム付与
	pub->>-S8: 登録結果返却
	note left of pub: result_code, item_granted

	alt result_code が PUB0000
	note over S8: 購入結果登録(status: completed)
	S8->>user: 購入完了画面表示
	S8->>user: 購入通知メール送信
	else result_code が PUB0000 以外
	S8->>pay: 決済取消(返金)※決済した場合
	note over S8: ポイント・クーポン返却・注文キャンセル(status: cancelled)
	S8->>user: 購入失敗表示
	end
	end