---
title: "シーケンス図"
site: "Game8 Store – Developer Center"
lang: "ja"
category: "技術仕様 & API"
canonical: "https://developers.store.game8.jp/ja/sequence/"
---

# シーケンス図

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

## ゲーム内アイテム購入

**図のソース（mermaid）**

```mermaid
sequenceDiagram
	autonumber
	actor user as ユーザー
	participant S8 as Game8 Store
	participant pub as ゲーム（パブリッシャーAPI）

	## 購入商品選択

	# 決済情報登録
	user->>+S8: クレジットカード情報送信
	note right of user: クレジットカード情報
	S8->>-user: e-Scott Transaction ID発行
	note left of S8: Transaction ID

	# 商品購入
	user->>S8: ゲーム内課金アイテム購入（クレジットカード情報送信と同時）
	note right of user: Transaction ID, ゲーム内ユーザーID, アイテムID, 利用ポイント数
	S8->>+pub: ゲーム内課金アイテム購入可否チェック（GET /check）
	note right of S8: Transaction ID, ゲーム内ユーザーID, アイテムID
	pub->>pub: アイテム確保
	note right of pub: Transaction ID, ゲーム内ユーザーID, アイテムID
	pub->>-S8: 確認結果返却
	note left of pub: 購入可否

	opt ポイント利用額が指定されている場合
	S8->>S8: 決済金額再計算
	end
	opt ポイントによる精算後に請求残高がある場合
	S8->>+S8: 決済実行
	note right of S8: Transaction ID, 決済金額, 商品情報
	S8->>-S8: 決済結果返却
	note left of S8: Transaction ID, 決済ステータス
	end

	# 決済成功後の即時通知
	S8->>+pub: ゲーム内課金アイテム販売実績登録（POST /register）
	note right of S8: Transaction ID, ゲーム内ユーザーID, アイテムID
	pub->>pub: アイテム加算
	pub->>-S8: アイテム登録結果返却
	note left of pub: 登録結果
	S8->>S8: 購入結果登録
	note over S8: Transaction ID, ユーザーID, ゲーム内ユーザーID, アイテムID, 決済金額, etc

	# ユーザーへの即時反映確認
	S8->>user: 購入完了画面表示
	note left of S8: 購入画面でアイテム登録結果
	S8->>user: 購入通知メール送信
	note left of S8: 購入通知メール
```
