跳到主要内容

错误码状态码与多语言拓展

响应状态码

状态码说明

  1. 公用状态码范围 0 - 999

  2. 特定业务状态码 1_000_00 - 9_999_99

    • 1_***_** 账号相关状态码

    • 2_***_** 支付相关状态码

    • 3_***_** 社交相关状态码

    • 4_***_** 广告相关状态码

常见响应状态码

状态码描述备注处理建议支持版本
0成功
400网络异常
500未知错误
501功能方法不支持
999无结果数据用于标示没有结果数据,可以理解为空
状态码描述备注处理建议支持版本
100010账号登录失败如果是"account is invalid"提示,联系运营,检查账号类型的后台签名、参数配置等是否与 apk 的签名、配置文件参数一致
100011账号登录失败,无帐号插件检查编译,是否将所有的依赖都打包成功。
2037禁止游客登录禁止当前设备 id 值使用游客登录,其他功能无影响游戏引导用户使用其他方式登录
100020账号登出失败
100090账号业务取消类型失败泛指账号相关业务(登录、登出、绑定等等)操作被取消
状态码描述备注处理建议支持版本
200000支付成功用户支付成功、商品消耗成功、并通知服务器成功。 注:商品消耗机制,不是每一个渠道都有。
200001支付并且消耗成功用户付款成功,支付 SDK 付款成功后未消耗成功时,通过后台机制处理,包含以下两种场景:
1. 消耗成功并通知服务器成功返回 200001
2. 消耗成功而通知服务器未成功,再次转入后台机制,之后按200002 逻辑处理。
200002付款成功,通知服务器失败1.用户支付成功或商品消耗但通知服务器未成功;
2.后台机制会自动处理,处理成功后无通知,除非多次失败需要人工介入。
3.用户切换前台会触发未发货检查机制。
告知用户付款成功等待发货
200003支付处理中
200004支付完成,结果未知1. 部分渠道不提供客户端的返回结果,只提供服务器对服务器的结果通知服务;
2. 项目如果接入这些渠道时(UC、微信 H5),请注意。
3. 因为渠道自身支付机制原因,OmniSDK 无法将这类 Code 合并处理,只能暴露出来,由于游戏等待渠道服务器的最终结果处理。
200010支付取消占位,通常不返回;游戏通过 onCancel() 回调处理
200011支付取消,参数不正确游戏检查商品参数是否正确v1.5.5
200012支付取消,快速点击本次点击事件被过滤,无响应Toast 提示v1.5.5
200013支付取消,当前有订单正在付款中已经有订单启动并处在支付界面或支付过程中,事件被过滤Toast 提示v1.5.5
200040支付失败,支付模块不存在通常是支付模块未依赖或配置
200050支付失败具体查看详细channel 错误信息
200051支付服务初始化设置失败游戏重启解决
200052支付错误,当前国家地区不支持购买1.与商务联系渠道支付支持的国家列表,并配置好;
2. 检查 VPN、帐号、银行卡是否为发行地区。
2000531000001. 检查参数;
2. 检查后台是否配置对应商品信息,并检验正确;
3. 其他情况联系 SDK 确认。
200054购买失败,之前购买的产品未被消耗无法重新购买建议用户重启游戏、等待15分钟间隔,触发 200001 机制。
200055支付错误,渠道的错误原因1. 渠道错误直接阅读返回的渠道状态码codeMsg.second;
2. 按渠道错误码要求进行修改。
3. 国内的手机,因为非标准 GP 环境,启动时 GP 可能就会返回;详情查看 GP 错误信息,非购买失败的,可以不用理会。
200056创建订单失败,账号未登录先登录再进行支付流程
200060支付数据验证失败Onestore 渠道
200080此渠道不支持传入的商品信息比如用户设备所属的国家不支持此商品,请核查商务签约的支付范围
200081没有此商品或商品已下架请运营配置正确的商品 id:Omni 后台与渠道后台
200082商品 PENDING 状态,用户按Google 提示完成付款订单挂起,当用户付款成功后,服务器后台收到 GP 通知,会主动通知发货。客户端 SDK 无法收到 GP 通知。
200083Purchase with unknown state1. GP 返回的异常,建议重新购买或检查网络环境
2. 参考 200055: 查看 GP 错误信息,非购买失败的,可以不用理会。
200084当前商品尚在订阅期内无法重复订阅注意200084 不要也不需要向用户展示,用户只需看到GP 的提示就行;因为 GP 可能会在一段时间内重复发送这个 code 类型,但其实是同一个订单;游戏应该在用户订阅过一次后,隐藏对应的订阅商品
状态码描述备注处理建议支持版本
300010分享失败
300011分享类型不支持请使用 OmniConstant 传类型
400010广告加载失败
400020广告显示失败

GooglePay 支付响应码

以 GP 文档为主

https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode

https://developer.android.com/google/play/billing/billing_reference

public @interface BillingResponseCode {
// The request has reached the maximum timeout before Google Play responds
int SERVICE_TIMEOUT = -3; // 正常失败处理

// Requested feature is not supported by Play Store on the current device
int FEATURE_NOT_SUPPORTED = -2; // 正常失败处理

// Play Store service is not connected now - potentially transient state.
int SERVICE_DISCONNECTED = -1; // 先正常失败处理;通过监听Play Store service 回调,正常时,弹出窗口:询问用户是否进行未支付订单处理,不支付则当无效订单处理

// Success.
int OK = 0; // 支付成功

// User pressed back or canceled a dialog.
int USER_CANCELED = 1; // 用户主动取消支付

// Network connection is down.
int SERVICE_UNAVAILABLE = 2; // 网络中断,弹窗:提示用户网络异常,是否重试,不重试则当无效订单处理

// Billing API version is not supported for the type requested.
int BILLING_UNAVAILABLE = 3; // 所请求的类型不支持 Google Play 结算服务 AIDL 版本:不支持所在国家(中国大陆)使用,解决方法,1. 清除GP商店、Service缓存数据,杀掉应用(可以清缓存);2. 切到可访问的VPN网络,打开GP商店(看到图书、电影标签说明正常)。3. 重新支付

// Requested product is not available for purchase.
int ITEM_UNAVAILABLE = 4; // 请求的商品已不再出售,正常失败处理,提示由游戏处理

// Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest.
int DEVELOPER_ERROR = 5; // 提供给 API 的参数无效。此错误也可能说明应用未针对结算服务正确签名或设置,或者在其清单中缺少必要的权限。参数(游戏处理)、签名问题:这个通常在测试阶段就会爆出,游戏处理。同时更热时注意参数。

// Fatal error during the API action.
int ERROR = 6; // API 操作期间出现严重错误:正常失败,OmniSDK 先尝试一次,再次失败时,回调正常失败逻辑

// Failure to purchase since item is already owned.
int ITEM_ALREADY_OWNED = 7;// 未能购买,因为已经拥有此商品:Consumed 问题,有商品未消耗导致无法进行新商品购买,通过机制触发订单表内这种状态的订单,进行消耗处理

// Failure to consume since item is not owned.
int ITEM_NOT_OWNED = 8; // 未能消费,因为尚未拥有此商品: 目前遇到一种是GP service 断掉,gp 直接返回 code 8
}

多语言扩展(如果需要自己增加翻译等)

信息

本节所说的状态码文案指的是 OmniSDK 状态码,包含上节的响应状态。

2021-08-16 新增

1.状态码 Code

// 中文
<!-- 商品 PENDING 状态,用户按Google提示完成付款 -->
<string name="omni_state_pay_code_200082">请按 Google 提示完成付款</string>

<!-- 商品 Purchase with unknown state,建议用户重新下单购买,或检查环境 -->
<string name="omni_state_pay_code_200083">支付异常,建议重新购买或检查网络环境</string>

<!-- 当前商品还在订阅期,无法重复订阅 -->
<!-- 注意200084 不要也不需要向用户展示,用户只需看到GP的提示就行;因为GP会在一段时间内重复发送这个code类型,但其实是同一个订单;游戏应该在用户订阅过一次后,隐藏对应的订阅商品-->
<del><string name="omni_state_pay_code_200084">当前商品尚在订阅期内无法重复订阅</string></del>


// 英文
<!-- 商品 PENDING 状态,用户按Google提示完成付款 -->
<string name="omni_state_pay_code_200082">Please complete the payment according to Google prompt.</string>

<!-- 商品 Purchase with unknown state,建议用户重新下单购买,或检查环境 -->
<string name="omni_state_pay_code_200083">Payment is abnormal,It is recommended to repurchase or check the network environment.</string>

<!-- 当前商品还在订阅期,无法重复订阅 -->
<string name="omni_state_pay_code_200084">The product is still in the subscription period,Cannot duplicate subscription.</string>

2.支付弹窗文案

// 中文
<string name="omni_pay_retry">点击重试</string>
<string name="omni_pay_progress">购买中 …</string>
<string name="omni_pay_network_error_try">网络异常,请点击重试</string>
<string name="omni_pay_delivering">购买成功,发货中 …</string>
<string name="omni_pay_try_delivering">发货中 …</string>
<string name="omni_pay_deliver_success">发货成功</string>
<string name="omni_pay_twice_dialog_title">发货失败</string>
<string name="omni_pay_twice_dialog_content">发货失败,请点击重试</string>

// 英文
<string name="omni_pay_progress">Purchasing …</string>
<string name="omni_pay_retry">Click Retry</string>
<string name="omni_pay_network_error_try">Network exception, please click Retry.</string>
<string name="omni_pay_delivering">Purchase succeeded and delivery is in progress.</string>
<string name="omni_pay_try_delivering">In shipment… </string>
<string name="omni_pay_deliver_success">Shipment succeeded.</string>
<string name="omni_pay_twice_dialog_title">Shipment failed.</string>
<string name="omni_pay_twice_dialog_content">Shipment failed, please click Retry.</string>

状态码对应的文案表

OmniSDK客户端文案本土化

截止 2021-07-09

注意,本文案表的内容,除非你接入相应功能,否则不需要全部适配多语言。

<string name="omni_state_account_code_100010">Login failed</string>
<string name="omni_state_account_code_100011">Login failed, no plugin</string>
<string name="omni_state_account_code_100020">Logout Failed</string>
<string name="omni_state_account_code_100101">Cancel</string>
<string name="omni_state_account_code_100121">Fill user name</string>
<string name="omni_state_account_code_100122">Fill correct email</string>
<string name="omni_state_account_code_100123">Fill password</string>
<string name="omni_state_account_code_100124">Password must between 6~18 characters</string>
<string name="omni_state_account_code_100125">Password too short</string>
<string name="omni_state_account_code_100126">Password too long</string>
<string name="omni_state_account_code_100127">The passwords are not the same</string>
<string name="omni_state_account_code_100128">Get verification</string>
<string name="omni_state_account_code_100301">Failed to login with facebook</string>
<string name="omni_state_account_code_100302">Failed to get the user information</string>
<string name="omni_state_account_code_100405">Account is invalid</string>
<string name="omni_state_account_code_100410">Application configuration error</string>
<string name="omni_state_account_code_100450">Google services not available on the device</string>
<string name="omni_state_account_code_105101">Failed to login with VK</string>
<string name="omni_state_code_0">Success</string>
<string name="omni_state_code_400">A network error occurred, please try again later</string>
<string name="omni_state_code_500">Unexpected error occurred</string>
<string name="omni_state_code_501">Function is not supported</string>
<string name="omni_state_pay_code_200000">Payment successful</string>
<string name="omni_state_pay_code_200001">Payment and consumption are successful</string>
<string name="omni_state_pay_code_200002">Payment is successful, but failed to notify the server of it</string>
<string name="omni_state_pay_code_200003">Payment is being processed</string>
<string name="omni_state_pay_code_200010">Payment cancelled</string>// 无用
<string name="omni_state_pay_code_200040">Payment failed because no payment plugin is found</string>
<string name="omni_state_pay_code_200050">Payment failed</string>
<string name="omni_state_pay_code_200051">Billing service setup failed</string>
<string name="omni_state_pay_code_200052">Purchase is not supported in your region</string>
<string name="omni_state_pay_code_200053">Failed to place order</string>
<string name="omni_state_pay_code_200054">Purchase failed because the product purchased before has not been consumed yet</string>
<string name="omni_state_pay_code_200055">Payment failed, unknown channel error</string>
<string name="omni_state_pay_code_200060">Payment data verification Failed</string>
<string name="omni_state_pay_code_200080">Payment failed, product not supported</string>
<string name="omni_state_pay_code_200081">Payment failed, product error</string>
<string name="omni_state_social_code_300010">Failed to share</string>
<string name="omni_state_social_code_300011">Share type is not supported</string>
<string name="omni_state_social_code_300015">Failed to share, No storage permissions</string>
<string name="omni_state_social_code_300310">Failed to share with facebook</string>
<string name="omni_state_social_code_300311">Content to be shared is invalid</string>
<string name="omni_state_social_code_300312">Facebook sdk cannot share the content</string>
<string name="omni_state_social_code_300320">Getting social information failed</string>
<string name="omni_state_social_code_300321">Getting social information cancelled</string>
<string name="omni_state_social_code_300330">Getting the friend List failed</string>
<string name="omni_state_social_code_300331">Getting the friend List cancelled</string>
<string name="omni_state_social_code_300340">Invitation failed</string>
<string name="omni_state_social_code_300341">Invitation cancelled</string>
<string name="omni_state_social_code_305110">Failed to share with VK</string>
<string name="omni_state_social_code_305120">Getting social information failed</string>
<string name="omni_state_social_code_305130">Getting the friend List failed</string>
<string name="omni_sg_account_already_bound_facebook">Your guest account has been associated to your Facebook account. For your account security, please log in with the associated account.</string>
<string name="omni_sg_account_already_bound_google">Your guest account has been associated to your Google account. For your account security, please log in with the associated account.</string>
<string name="omni_sg_account_already_bound_line">Your guest account has been associated to your Line account. For your account security, please log in with the associated account.</string>
<string name="omni_sg_account_already_bound_sg">Your guest account has been associated to your Seasun Games account. For your account security, please log in with the associated account.</string>

如何进行多言语更改、适配

OmniSDK code 对应文案表,项目如果需要自己适配多语言,有两种方式

方案一:修改 xml

在(app-level)下的 res 目录,新建文件 strings_omni.xml ,根据 Android 的多语言 适配。增加 文案表 里的对 code,编译时会自动覆盖。

// 示例
<string name="omni_state_social_code_305130">New String</string>

img

方案二:code 处理

游戏自己处理:按照使用场景、在相应的回调上,按照返回的 code,替换成自己的 msg 文案。

快速查询 App 的多语言文案

源码查看

使用 Android Studio 打开工程,进入以下目录,直接查看编译后 values.xml 文件。

img

APK 解析查看

打开 Android Studio,将编译后的 APK 或 AAB 文件,拖进窗口。

img