diff --git a/other/pay.md b/other/pay.md new file mode 100644 index 0000000..be50d36 --- /dev/null +++ b/other/pay.md @@ -0,0 +1,455 @@ +# 游戏充值 + +- [游戏充值](#游戏充值) + - [操作步骤](#pay-step) + - [请求商店内容](#请求商店内容) + - [创建订单信息](#创建订单信息) + - [获取订单支付状态](#获取订单支付状态) + +--- + +## 游戏充值 + +*注:这是网页api,并非游戏内api,因此游戏部分内容(例如原神纪行类内容)无法通过该api进行购买* + +

操作步骤

+ +1. 请求商店内容 +2. 创建订单信息 +3. 获取订单支付状态 + +### 请求商店内容 + +_请求方式:POST + +`https://{游戏id}-sdk.mihoyo.com/{游戏区服id}/mdk/shopwindow/shopwindow/fetchGoods` +例如:`https://hk4e-sdk.mihoyo.com/hk4e_cn/mdk/shopwindow/shopwindow/fetchGoods` + +**参数:** + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| released_flag | bool | 未知 | | +| game | str | 游戏区服id | 必须与url中的游戏id一致 | +| region | str | 服务器id | 必须与url中的游戏区服id一致 | +| uid | str | 游戏uid | | +| account | str | 米游社uid | | + +**JSON返回:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| retcode | num | 返回码 | | +| data | obj | 返回数据 | | +| message | str | 返回信息 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| goods_list | list | 商店物品列表 | | + +`data`对象→列表→`goods_list`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| goods_id | str | 商品id | | +| goods_name | str | 商品名称 | | +| goods_name_i18n_key | str | 未知 | | +| goods_desc | str | 商品介绍 | | +| goods_desc_i18n_key | str | 未知 | | +| goods_type | str | 商品类型 | MonthlyCard 月卡类商品
Normal 普通商品 | +| goods_unit | str | 商品个数 | | +| goods_icon | str | 商品图标 | | +| currency | str | 货币计算单位缩写 | CNY 人民币 | +| price | str | 价格 | 按使用货币的最小单位计算(例如货币计算单位为人民币时,此处单位为分;原神中空月祝福的价格为30元人民币,则此处的值为3000) | +| symbol | str | 货币单位符号 | | +| tier_id | str | 商品层级id | | +| bonus_desc | obj | 附赠内容介绍 | 非首充状态时展示的内容 | +| once_bonus_desc | obj | 附赠内容介绍 | 首充状态时展示的内容,不存在首充、用户已使用首充或商品为月卡类物品时值为null | +| available | bool | 是否可用 | | +| tips_desc | str | 未知 | | +| tips_i18n_key | str | 未知 | | +| battle_pass_limit | str | 未知 | | + +`data`对象→列表→`goods_list`对象→`bonus_desc`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------------------- | ---- | ------------ | ---- | +| bonus_desc | str | 附赠内容名称 | | +| bonus_desc_i18n_key | str | 未知 | | +| bonus_unit | num | 附赠内容个数 | | +| bonus_goods_id | str | 附赠内容id | | +| bonus_icon | str | 附赠内容图标 | | + +
+查看示例 + + ```json + { + "retcode": 0, + "message": "OK", + "data": { + "goods_list": [ + { + "goods_id": "ys_chn_primogem1ststall_tier1", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "60", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/0f362595da2e37a7a8fde1bb120656d2_594155779359709441.png", + "currency": "CNY", + "price": "600", + "symbol": "¥", + "tier_id": "Tier_1", + "bonus_desc": { + "bonus_desc": "", + "bonus_desc_i18n_key": "", + "bonus_unit": 0, + "bonus_goods_id": "", + "bonus_icon": "" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_primogem2ndstall_tier5", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "300", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/830e247bb0cfffa5c74a04e79c0040f5_1814106121630644354.png", + "currency": "CNY", + "price": "3000", + "symbol": "¥", + "tier_id": "Tier_5", + "bonus_desc": { + "bonus_desc": "原石", + "bonus_desc_i18n_key": "", + "bonus_unit": 30, + "bonus_goods_id": "", + "bonus_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/bd9f0229dd9b07a6a4f355560634e26e_9134197201842315357.png" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_primogem3rdstall_tier15", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "980", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/dfefc92ce56e3b5615ef28d6b1119b8b_5835214000384994274.png", + "currency": "CNY", + "price": "9800", + "symbol": "¥", + "tier_id": "Tier_15", + "bonus_desc": { + "bonus_desc": "原石", + "bonus_desc_i18n_key": "", + "bonus_unit": 110, + "bonus_goods_id": "", + "bonus_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/bd9f0229dd9b07a6a4f355560634e26e_6996232761265057834.png" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_primogem4thstall_tier30", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "1980", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/e918ecfedcb13113eb627fd944199272_3460055016813877022.png", + "currency": "CNY", + "price": "19800", + "symbol": "¥", + "tier_id": "Tier_30", + "bonus_desc": { + "bonus_desc": "原石", + "bonus_desc_i18n_key": "", + "bonus_unit": 260, + "bonus_goods_id": "", + "bonus_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/bd9f0229dd9b07a6a4f355560634e26e_2358463156075320275.png" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_primogem5thstall_tier50", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "3280", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/70e703a64e8786390ab8b7cdc35dbeeb_6358952826545947027.png", + "currency": "CNY", + "price": "32800", + "symbol": "¥", + "tier_id": "Tier_50", + "bonus_desc": { + "bonus_desc": "原石", + "bonus_desc_i18n_key": "", + "bonus_unit": 600, + "bonus_goods_id": "", + "bonus_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/bd9f0229dd9b07a6a4f355560634e26e_1730792081423418950.png" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_primogem6thstall_tier60", + "goods_name": "创世结晶", + "goods_name_i18n_key": "", + "goods_desc": "", + "goods_desc_i18n_key": "", + "goods_type": "Normal", + "goods_unit": "6480", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/24fa6b6190ce5da6928e431a832d85c3_5932007685099741224.png", + "currency": "CNY", + "price": "64800", + "symbol": "¥", + "tier_id": "Tier_60", + "bonus_desc": { + "bonus_desc": "原石", + "bonus_desc_i18n_key": "", + "bonus_unit": 1600, + "bonus_goods_id": "", + "bonus_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2022/09/07/bd9f0229dd9b07a6a4f355560634e26e_8010514725467837459.png" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + }, + { + "goods_id": "ys_chn_blessofmoon_tier5", + "goods_name": "空月祝福", + "goods_name_i18n_key": "", + "goods_desc": "

【空月祝福介绍】
\n每次购买空月祝福,可立即获得300创世结晶与为期30天的空月祝福生效时间。

\n\n

空月祝福生效时间内,每日可登录领取90原石。(每日凌晨4点更新【GMT+8】)

\n\n

【注意事项】
\n1. 空月祝福剩余生效时间≤180天时续购,总生效时间才会延长。

\n\n

2. 当空月祝福剩余生效时间>180天时不可再进行购买。但如因特殊情况导致重复购买,总生效时间将无法累加,并将直接返还330创世结晶。

\n\n

3. 玩家在空月祝福生效期间如因未登录而未领取的原石,将不会返还。

\n", + "goods_desc_i18n_key": "", + "goods_type": "MonthlyCard", + "goods_unit": "0", + "goods_icon": "https://sdk-webstatic.mihoyo.com/sdk-payment-upload/2020/06/08/2da77803b9b2ffc2a2b763a59e9c125f_5219067706372136934.png", + "currency": "CNY", + "price": "3000", + "symbol": "¥", + "tier_id": "Tier_5", + "bonus_desc": { + "bonus_desc": "", + "bonus_desc_i18n_key": "", + "bonus_unit": 0, + "bonus_goods_id": "", + "bonus_icon": "" + }, + "once_bonus_desc": null, + "available": true, + "tips_desc": "", + "tips_i18n_key": "", + "battle_pass_limit": "0" + } + ] + } + } + ``` + +
+ + +### 创建订单信息 + +_请求方式:POST_ + +`https://{游戏id}-sdk.mihoyo.com/{游戏区服id}/mdk/atropos/api/createOrder` +例如:`https://hk4e-sdk.mihoyo.com/hk4e_cn/mdk/atropos/api/createOrder` + +**参数:** + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| open_id | str | 未知 | | +| special_info | str | 未知 | 通过网页方式充值的值为topup_center | +| order | obj | 订单信息 | | +| sign | str | 订单签名 | 生成方式见下 | + +`order`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| account | str | 米游社uid | | +| region | str | 游戏区服id | | +| uid | str | 游戏id | | +| delivery_url | str | 未知 | | +| device | str | 设备id | | +| channel_id | int | 未知 | | +| client_ip | str | 未知 | | +| client_type | int | 订单请求平台id | | +| game | str | 游戏标识符id | | +| amount | str | 商品价格 | | +| goods_num | int | 商品个数 | | +| goods_id | str | 商品id | | +| goods_title | str | 商品名称 | | +| price_tier | str | 价格层级 | | +| currency | str | 货币单位 | | +| pay_plat | str | 支付平台 | alipay 支付宝 | +| pay_type | str | 支付方式 | alipay 支付宝 | +| pay_vendor | str | 支付供应商 | alipay 支付宝 | + +**JSON返回:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| retcode | num | 返回码 | | +| data | obj | 返回数据 | | +| message | str | 返回信息 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| account | str | 米游社uid | | +| action | str | 未知 | | +| amount | str | 待支付金额 | | +| balance | str | 未知 | | +| cluster | str | 未知 | | +| create_time | str | 订单创建时间戳 | | +| currency | str | 货币单位简称 | | +| encode_order | str | 支付链接 | 生成的二维码所指向的链接 | +| ext_info | str | 未知 | | +| foreign_serial | str | 未知 | | +| goods_id | str | 商品id | | +| method | str | 未知 | | +| order_no | str | 支付平台订单编号 | | +| redirect_url | str | 支付网关url | | +| session_cookie | str | 未知 | | + +**备注:** + +
+查看示例 +```json +{ + 'data': + { + 'account': '311526738', + 'action': '', + 'amount': '3000', + 'balance': '0', + 'cluster': '', + 'create_time': '1694413535', + 'currency': 'CNY', + 'encode_order': 'https://qr.alipay.com/bax05682icnzhnjqivkf00c3', + 'ext_info': '', + 'foreign_serial': '', + 'goods_id': 'ys_chn_blessofmoon_tier5', + 'method': '', + 'order_no': '1701119779159945792', + 'redirect_url': 'https://openapi.alipay.com/gateway.do', + 'session_cookie': '' + }, + 'message': 'OK', + 'retcode': 0 +} +``` + +
+ +### 获取订单支付状态 + +_请求方式:GET_ + +`https://{游戏标识符id}-sdk.mihoyo.com/{游戏区服id}/mdk/atropos/api/checkOrder` +例如:`https://hk4e-sdk.mihoyo.com/hk4e_cn/mdk/atropos/api/checkOrder` + +**参数:** + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| order_no | str | 支付平台订单编号 | | +| game | str | 游戏区服id | | +| region | str | 服务器id | | +| uid | str | 游戏uid | | + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| retcode | num | 返回码 | | +| data | obj | 返回数据 | | +| message | str | 返回信息 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| amount | str | 价格 | | +| goods_num | str | 商品数量 | | +| goods_title | str | 商品名称 | | +| order_no | str | 支付平台订单编号 | | +| pay_plat | str | 支付平台 | | +| status | str | 支付状态 | 1 未支付
900 已支付 | + +
+查看示例 + +- 请求:`https://hk4e-sdk.mihoyo.com/hk4e_cn/mdk/atropos/api/checkOrder?order_no=1701125802130158976&game=hk4e_cn®ion=cn_gf01&uid=216973385` +- 返回: + ```json + //未支付 + { + "retcode": 0, + "message": "OK", + "data": { + "status": 1, + "amount": "600", + "goods_title": "创世结晶×60", + "goods_num": "1", + "order_no": "1701125802130158976", + "pay_plat": "alipay" + } + } + //已支付 + { + "retcode": 0, + "message": "OK", + "data": { + "status": 900, + "amount": "600", + "goods_title": "创世结晶×60", + "goods_num": "1", + "order_no": "1701125802130158976", + "pay_plat": "alipay" + } + } + ``` + +