// SPDX-License-Identifier: MIT package appendix // ErrorCode 是错误码总表项。绝大多数业务错误返回 HTTP 200 + 信封 {code, message, data},个别异常见 HTTP 字段。 type ErrorCode struct { Code string HTTP int Retryable string MeaningZh string MeaningEn string NoteZh string NoteEn string } // ErrorCodes 错误码总表(平台标准项)。 var ErrorCodes = []ErrorCode{ {Code: "100000", HTTP: 200, Retryable: "depends", MeaningZh: "通用业务失败 / 鉴权失败统一码", MeaningEn: "Generic business failure / unified auth-failure code", NoteZh: "鉴权阶段(凭据无效/禁用、商户或上级代理禁用等)统一收敛为本码与「认证失败」话术以防枚举;其他未归类业务失败亦可能返回本码(代收上游建单失败已独立为 300415),请结合 message 排查,下单类结果未知时先查单确认", NoteEn: "Auth failures (invalid/disabled credential, disabled merchant or agent, etc.) are unified into this code with a generic \"Authentication failed\" message to prevent enumeration; other unclassified business failures may also return this code (collection upstream creation rejection now uses 300415). Check message and confirm order status via query before retrying"}, {Code: "100001", HTTP: 200, Retryable: "no", MeaningZh: "参数校验失败", MeaningEn: "Parameter validation failed", NoteZh: "message 为具体字段校验错误信息;amount 必须为 JSON 整数且符合该币种单笔范围与小数精度步长(如 PHP/CNY 最多 2 位小数即 100 整数倍,VND/IDR 仅整数主单位即 10000 整数倍),字符串/小数/超精度均返回此码。修正参数后重发", NoteEn: "message carries the specific field validation error; amount must be a JSON integer within the currency range and decimal precision step (e.g. PHP/CNY at most 2 decimals = multiple of 100, VND/IDR whole units = multiple of 10000) — strings, floats, or excess decimals return this code. Fix params and resend"}, {Code: "100101", HTTP: 200, Retryable: "yes", MeaningZh: "请求过期", MeaningEn: "Request expired", NoteZh: "timestamp 超出 ±300 秒窗口;校准本地时间后重试", NoteEn: "timestamp is outside the ±300s window; calibrate local time and retry"}, {Code: "100102", HTTP: 200, Retryable: "no", MeaningZh: "IP 不在白名单(message 含商户号与请求 IP)", MeaningEn: "IP not in allowlist (message includes merchant_no and request IP)", NoteZh: "在商户后台把来源 IP 加入白名单后重试;正式密钥与测试密钥共用同一白名单", NoteEn: "Add the source IP to the allowlist in the merchant console and retry; prod and test keys share the same allowlist"}, {Code: "100103", HTTP: 200, Retryable: "no", MeaningZh: "重放 / 重复请求", MeaningEn: "Replay / duplicate request", NoteZh: "nonce 或签名指纹在 600 秒内重复;换新 nonce(或改参数)后重试", NoteEn: "nonce or signature fingerprint repeated within 600s; use a new nonce (or change params) and retry"}, {Code: "100104", HTTP: 200, Retryable: "no", MeaningZh: "签名错误", MeaningEn: "Invalid signature", NoteZh: "核对密钥与签名算法(pay 用 api_secret_pay、payout 用 api_secret_payout)", NoteEn: "Check the secret and signing algorithm (pay uses api_secret_pay, payout uses api_secret_payout)"}, {Code: "100105", HTTP: 200, Retryable: "no", MeaningZh: "IP 在黑名单", MeaningEn: "IP in blocklist", NoteZh: "从黑名单移除来源 IP 后重试", NoteEn: "Remove the source IP from the blocklist and retry"}, {Code: "100106", HTTP: 200, Retryable: "yes", MeaningZh: "鉴权失败次数过多(限流)", MeaningEn: "Too many auth failures (rate limited)", NoteZh: "同 merchant_no + 来源 IP 在 60 秒内鉴权失败达 60 次触发;等待约 60 秒再试", NoteEn: "Triggered when the same merchant_no + source IP fails auth 60 times within 60s; wait ~60s and retry"}, {Code: "100107", HTTP: 200, Retryable: "yes", MeaningZh: "系统维护中", MeaningEn: "System under maintenance", NoteZh: "HTTP 200 信封,响应头附带 Retry-After(秒),data 含 { maintenance, mode, planned_end, source, gate_id };停写维护时本地只读查询接口仍可用(payout/proof/query 因需回源上游渠道也会暂停),全量维护时除 /version 外均暂停;请按 Retry-After 退避重试", NoteEn: "HTTP 200 envelope with Retry-After header (seconds) and data { maintenance, mode, planned_end, source, gate_id }; during write_only maintenance local read endpoints stay available (payout/proof/query also pauses because it queries upstream channels), during full maintenance all endpoints except /version pause; retry after Retry-After"}, {Code: "100108", HTTP: 429, Retryable: "yes", MeaningZh: "落地页读单过于频繁", MeaningEn: "Too many landing-page reads", NoteZh: "同一 IP 每 60 秒超过 6000 次调用落地页订单详情或状态接口。HTTP 429,响应头 Retry-After 为窗口秒数;降低轮询频率后重试", NoteEn: "The same IP called the landing-page order detail or status endpoint more than 6000 times within 60 seconds. HTTP 429, with Retry-After set to the window in seconds; slow down polling and retry"}, {Code: "300101", HTTP: 200, Retryable: "no", MeaningZh: "商户订单号已存在", MeaningEn: "Merchant order number already exists", NoteZh: "同一商户 out_order_no 重复提交一律拒绝(无论参数是否相同,不返回原单);请先查单或更换新单号", NoteEn: "Duplicate out_order_no is always rejected (regardless of params; original order is never returned). Query the order or use a new number."}, {Code: "300201", HTTP: 200, Retryable: "no", MeaningZh: "商户代付单号已存在", MeaningEn: "Merchant payout number already exists", NoteZh: "同一商户 out_payout_no 重复提交一律拒绝(无论参数是否相同,不返回原单);请先查单或更换新单号", NoteEn: "Duplicate out_payout_no is always rejected (regardless of params; original order is never returned). Query the order or use a new number."}, {Code: "300301", HTTP: 200, Retryable: "no", MeaningZh: "订单不存在", MeaningEn: "Order not found", NoteZh: "核对订单号(order_no / out_order_no / payout_no / out_payout_no)", NoteEn: "Check the order no. (order_no / out_order_no / payout_no / out_payout_no)"}, {Code: "300308", HTTP: 200, Retryable: "no", MeaningZh: "工单不存在", MeaningEn: "Ticket not found", NoteZh: "核对工单号或订单号", NoteEn: "Check the ticket number or the order number"}, {Code: "300309", HTTP: 200, Retryable: "no", MeaningZh: "当前订单状态不接受工单", MeaningEn: "The current order status does not accept a ticket", NoteZh: "具体原因在 message 里,不单靠这个码", NoteEn: "The specific reason is in message; do not rely on this code alone"}, {Code: "300302", HTTP: 500, Retryable: "yes", MeaningZh: "订单数据暂不可用", MeaningEn: "Order data temporarily unavailable", NoteZh: "pay/create 响应装配或落地页订单详情在本地订单数据暂时读不出时返回,HTTP 500。pay/create 遇此码请先用 pay/query 查单确认,勿盲目换单号重试;落地页轮询改走状态接口", NoteEn: "Returned by pay/create response assembly or the landing-page order detail endpoint when local order data cannot be read, HTTP 500. On pay/create, confirm via pay/query first instead of retrying blindly with a new number; on landing pages, poll the status endpoint"}, {Code: "300304", HTTP: 503, Retryable: "yes", MeaningZh: "建单暂不可用(订单未创建,可用同一外部单号重试)", MeaningEn: "Order create temporarily unavailable (nothing persisted; retry with the same merchant order no.)", NoteZh: "系统高并发建单锁争用或规则暂未就绪,订单未落库;HTTP 503。请用同一 out_order_no / out_payout_no 稍后重试,勿换单号以免产生重复单", NoteEn: "Temporary order-creation contention or rule initialization delay; nothing was persisted (HTTP 503). Retry later with the same out_order_no / out_payout_no — do not change the number or you may create a duplicate"}, {Code: "300401", HTTP: 200, Retryable: "no", MeaningZh: "支付方式不可用 / 不存在", MeaningEn: "Payment method unavailable / missing", NoteZh: "支付方式不可用或不存在", NoteEn: "The payment method is unavailable or does not exist"}, {Code: "300402", HTTP: 200, Retryable: "yes", MeaningZh: "支付方式配置不可用", MeaningEn: "Payment method configuration unavailable", NoteZh: "当前请求未匹配到有效配置;修改参数或稍后重试", NoteEn: "No valid configuration matched the request; change parameters or retry later"}, {Code: "300403", HTTP: 200, Retryable: "no", MeaningZh: "费率未配置", MeaningEn: "Fee rate not configured", NoteZh: "联系服务商配置费率后重试", NoteEn: "Contact your service provider to configure the fee rate, then retry"}, {Code: "300404", HTTP: 200, Retryable: "yes", MeaningZh: "当前条件下无可用支付方式", MeaningEn: "No payment method is available for the request", NoteZh: "country + currency + pay_method 未匹配到启用分组;核对参数或联系运营开通", NoteEn: "country + currency + pay_method matched no enabled group; check the parameters or contact operations to enable one"}, {Code: "300405", HTTP: 200, Retryable: "no", MeaningZh: "缺少必要附加信息(extra.customer)", MeaningEn: "Missing required extra info (extra.customer)", NoteZh: "请按 `data.missing_fields` 补齐 extra.customer 中的字段", NoteEn: "Fill the fields listed in `data.missing_fields` under extra.customer"}, {Code: "300406", HTTP: 200, Retryable: "no", MeaningZh: "缺少必要下单参数(如 bank_code)", MeaningEn: "Missing required order parameter (e.g. bank_code)", NoteZh: "补齐该路由必填字段后重试", NoteEn: "Fill the required field for that route and retry"}, {Code: "300407", HTTP: 200, Retryable: "no", MeaningZh: "银行编码非法", MeaningEn: "Invalid bank code", NoteZh: "用「查询可用银行」(payout/banks/query) 返回的 code", NoteEn: "Use a code returned by Query Available Banks (payout/banks/query)"}, {Code: "300408", HTTP: 200, Retryable: "no", MeaningZh: "当前支付方式不支持代付凭证查询", MeaningEn: "Payment method does not support payout proof query", NoteZh: "当前支付方式不支持凭证查询", NoteEn: "The payment method does not support proof queries"}, {Code: "300409", HTTP: 200, Retryable: "yes", MeaningZh: "代付凭证暂不可用", MeaningEn: "Payout proof temporarily unavailable", NoteZh: "订单未成功 / 凭证暂未生成 / 超出查询窗口;确认成功且在窗口内再试", NoteEn: "Order is not successful / proof is not ready / outside the query window; confirm success and retry within the window"}, {Code: "300410", HTTP: 200, Retryable: "depends", MeaningZh: "代付收据暂不可用(订单非 success)", MeaningEn: "Payout receipt temporarily unavailable (order not success)", NoteZh: "仅 status=success 的正式代付单支持收据。订单仍在处理中(pending)时可待成功后重试;订单已失败(failed)为终态请勿重试。测试环境统一返回不可重试的 300416", NoteEn: "Only live payouts with status=success have receipts. Retry only while the order is pending; do not retry once failed. Test credentials return non-retryable 300416"}, {Code: "300411", HTTP: 200, Retryable: "yes", MeaningZh: "收据生成失败", MeaningEn: "Receipt generation failed", NoteZh: "渲染异常;稍后重试", NoteEn: "Rendering error; retry later"}, {Code: "300415", HTTP: 200, Retryable: "no", MeaningZh: "代收上游建单失败(订单已置 failed)", MeaningEn: "Collection upstream creation failed (order set to failed)", NoteZh: "订单已被平台落库并实时置为 failed,原 out_order_no 已占用;勿用同一 out_order_no 重试,请更换新 out_order_no 后重新下单", NoteEn: "The order was persisted and immediately marked failed, occupying out_order_no; do not retry with the same out_order_no — generate a new out_order_no to re-submit"}, {Code: "300416", HTTP: 200, Retryable: "no", MeaningZh: "当前环境或支付方式不支持代付收据查询", MeaningEn: "Payout receipt query is not supported in this environment or payment method", NoteZh: "例如使用测试环境密钥(env=test)查询收据时恒返回本码(与凭证接口 300408 对齐);不可重试,请勿轮询", NoteEn: "For example, calling payout/receipt/query with test credentials (env=test) always returns this code (aligned with 300408 for proof); non-retryable — do not poll"}, {Code: "300501", HTTP: 200, Retryable: "yes", MeaningZh: "余额不足", MeaningEn: "Insufficient balance", NoteZh: "商户可用余额 < 冻结额(amount + fee);充值后重试", NoteEn: "Available balance < frozen amount (amount + fee); top up and retry"}, }