---
title: "时序图"
site: "Game8 Store – Developer Center"
lang: "zh"
category: "技术规格与 API"
canonical: "https://developers.store.game8.jp/zh/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: 购买通知邮件
```
