API及平台设置
管理API密钥和各平台设置。由API密钥、Android、iOS选项卡组成。
API密钥
管理服务器连接所需的密钥。
| 项目 | 说明 |
|---|---|
| Service Key | API调用时使用的服务密钥。可通过复制按钮复制到剪贴板。 |
| Secret Key | API认证使用的密钥。可通过复制按钮复制到剪贴板。 |
Secret Key请注意不要泄露。可通过刷新按钮发放新密钥。
Android设置
管理Android应用内购买(IAP)收据验证所需的设置。
| 项目 | 说明 |
|---|---|
| 包名称 | 输入Android应用的包名称。(必填,例:com.example.game)用于在收据验证时确认包名称是否匹配。 |
| 许可证密钥 | 输入从Google Play Console获取的RSA公钥。(必填)用于收据签名验证。 |
| 认证密钥文件 | 上传Google Play服务账号的JSON认证密钥文件。(必填)用于Google Play Developer API集成。 |
包名称和许可证密钥用于Google Play收据验证。包名称通过验证包名称是否匹配来防止收据伪造,许可证密钥用于验证来自Google Play的收据签名。许可证密钥可在Google Play Console > 创收设置中查看。认证密钥文件可在Google Cloud Console > IAM和管理 > 服务账号中生成JSON密钥并下载。
iOS设置
管理iOS应用内购买(IAP)收据验证和App Store Server API集成所需的设置。
| 项目 | 说明 |
|---|---|
| Bundle Identifier | 输入iOS应用的Bundle标识符。(必填,例:com.example.game)用于在收据验证时确认Bundle ID是否匹配。 |
| Application ID | 输入可在App Store Connect中确认的应用ID。(必填) |
| Team ID | 输入Apple Developer账号的Team ID。(必填) |
| Service ID | 输入用于App Store Server API集成的Service ID。 |
| Key ID | 输入用于App Store Server API认证的Key ID。 |
| Master Password | 输入订阅商品收据验证时发送到Apple服务器的应用专用密码。 |
| Key File | 上传用于App Store Server API认证的密钥文件(.p8)。(必填) |
Bundle Identifier和Master Password用于iOS IAP收据验证。Bundle Identifier通过验证Bundle ID是否匹配来防止收据伪造,Master Password在订阅商品验证时发送到Apple服务器(verifyReceipt)。Key File(.p8)和Key ID可在Apple Developer > Certificates, Identifiers & Profiles > Keys中生成和下载。
Unity IAP 5.0 (StoreKit 2) 的签名交易 (JWS) 验证不需要 Key File(.p8)。 由于以 Apple Root CA G3 为基准在本地验证 JWS 内置的证书链,Key ID·Key File 仅用于 Sign in with Apple(社交登录)。
App Store Server Notifications (Webhook)
若要实时接收 Apple 的退款、订阅变更等事件,请将 iOS 设置下方的 Webhook URL 注册到 App Store Connect。此 URL 按游戏自动生成,可通过复制按钮复制到剪贴板。
https://service-api.playnanoo.com/webhook/apple/{gameId}
{gameId}会自动替换为游戏频道 ID。请使用复制按钮复制控制台中显示的实际 URL。
| 步骤 | 说明 |
|---|---|
| 1 | 进入 App Store Connect > 选择应用 > 应用信息 > App Store Server Notifications |
| 2 | 在 Production Server URL 中输入上述 Webhook URL |
| 3 | 在 Sandbox Server URL 中也输入相同的 URL |
| 4 | Notification Version 选择 "Version 2" 并保存 |
Webhook 以游戏(应用)为单位运行,因此无论 SDK 版本如何,只要注册 URL 即可应用退款追踪。Production / Sandbox 的区分由 Apple 发送的 payload 中的 environment 字段自动判别。