# SPDX-License-Identifier: MIT # 错误码总表(平台标准项)。绝大多数业务错误返回 HTTP 200 + 信封 {code, message, data},个别异常见 http 字段。 ERROR_CODES = [ {"code": "100000", "http": 200, "retryable": "depends", "meaning_zh": "通用业务失败 / 鉴权失败统一码", "meaning_en": "Generic business failure / unified auth-failure code", "note_zh": "鉴权阶段(凭据无效/禁用、商户或上级代理禁用等)统一收敛为本码与「认证失败」话术以防枚举;其他未归类业务失败亦可能返回本码(代收上游建单失败已独立为 300415),请结合 message 排查,下单类结果未知时先查单确认", "note_en": "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", "meaning_zh": "参数校验失败", "meaning_en": "Parameter validation failed", "note_zh": "message 为具体字段校验错误信息;amount 必须为 JSON 整数且符合该币种单笔范围与小数精度步长(如 PHP/CNY 最多 2 位小数即 100 整数倍,VND/IDR 仅整数主单位即 10000 整数倍),字符串/小数/超精度均返回此码。修正参数后重发", "note_en": "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", "meaning_zh": "请求过期", "meaning_en": "Request expired", "note_zh": "timestamp 超出 ±300 秒窗口;校准本地时间后重试", "note_en": "timestamp is outside the ±300s window; calibrate local time and retry"}, {"code": "100102", "http": 200, "retryable": "no", "meaning_zh": "IP 不在白名单(message 含商户号与请求 IP)", "meaning_en": "IP not in allowlist (message includes merchant_no and request IP)", "note_zh": "在商户后台把来源 IP 加入白名单后重试;正式密钥与测试密钥共用同一白名单", "note_en": "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", "meaning_zh": "重放 / 重复请求", "meaning_en": "Replay / duplicate request", "note_zh": "nonce 或签名指纹在 600 秒内重复;换新 nonce(或改参数)后重试", "note_en": "nonce or signature fingerprint repeated within 600s; use a new nonce (or change params) and retry"}, {"code": "100104", "http": 200, "retryable": "no", "meaning_zh": "签名错误", "meaning_en": "Invalid signature", "note_zh": "核对密钥与签名算法(pay 用 api_secret_pay、payout 用 api_secret_payout)", "note_en": "Check the secret and signing algorithm (pay uses api_secret_pay, payout uses api_secret_payout)"}, {"code": "100105", "http": 200, "retryable": "no", "meaning_zh": "IP 在黑名单", "meaning_en": "IP in blocklist", "note_zh": "从黑名单移除来源 IP 后重试", "note_en": "Remove the source IP from the blocklist and retry"}, {"code": "100106", "http": 200, "retryable": "yes", "meaning_zh": "鉴权失败次数过多(限流)", "meaning_en": "Too many auth failures (rate limited)", "note_zh": "同 merchant_no + 来源 IP 在 60 秒内鉴权失败达 60 次触发;等待约 60 秒再试", "note_en": "Triggered when the same merchant_no + source IP fails auth 60 times within 60s; wait ~60s and retry"}, {"code": "100107", "http": 200, "retryable": "yes", "meaning_zh": "系统维护中", "meaning_en": "System under maintenance", "note_zh": "HTTP 200 信封,响应头附带 Retry-After(秒),data 含 { maintenance, mode, planned_end, source, gate_id };停写维护时本地只读查询接口仍可用(payout/proof/query 因需回源上游渠道也会暂停),全量维护时除 /version 外均暂停;请按 Retry-After 退避重试", "note_en": "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", "meaning_zh": "落地页读单过于频繁", "meaning_en": "Too many landing-page reads", "note_zh": "同一 IP 每 60 秒超过 6000 次调用落地页订单详情或状态接口。HTTP 429,响应头 Retry-After 为窗口秒数;降低轮询频率后重试", "note_en": "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", "meaning_zh": "商户订单号已存在", "meaning_en": "Merchant order number already exists", "note_zh": "同一商户 out_order_no 重复提交一律拒绝(无论参数是否相同,不返回原单);请先查单或更换新单号", "note_en": "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", "meaning_zh": "商户代付单号已存在", "meaning_en": "Merchant payout number already exists", "note_zh": "同一商户 out_payout_no 重复提交一律拒绝(无论参数是否相同,不返回原单);请先查单或更换新单号", "note_en": "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", "meaning_zh": "订单不存在", "meaning_en": "Order not found", "note_zh": "核对订单号(order_no / out_order_no / payout_no / out_payout_no)", "note_en": "Check the order no. (order_no / out_order_no / payout_no / out_payout_no)"}, {"code": "300308", "http": 200, "retryable": "no", "meaning_zh": "工单不存在", "meaning_en": "Ticket not found", "note_zh": "核对工单号或订单号", "note_en": "Check the ticket number or the order number"}, {"code": "300309", "http": 200, "retryable": "no", "meaning_zh": "当前订单状态不接受工单", "meaning_en": "The current order status does not accept a ticket", "note_zh": "具体原因在 message 里,不单靠这个码", "note_en": "The specific reason is in message; do not rely on this code alone"}, {"code": "300302", "http": 500, "retryable": "yes", "meaning_zh": "订单数据暂不可用", "meaning_en": "Order data temporarily unavailable", "note_zh": "pay/create 响应装配或落地页订单详情在本地订单数据暂时读不出时返回,HTTP 500。pay/create 遇此码请先用 pay/query 查单确认,勿盲目换单号重试;落地页轮询改走状态接口", "note_en": "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", "meaning_zh": "建单暂不可用(订单未创建,可用同一外部单号重试)", "meaning_en": "Order create temporarily unavailable (nothing persisted; retry with the same merchant order no.)", "note_zh": "系统高并发建单锁争用或规则暂未就绪,订单未落库;HTTP 503。请用同一 out_order_no / out_payout_no 稍后重试,勿换单号以免产生重复单", "note_en": "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", "meaning_zh": "支付方式不可用 / 不存在", "meaning_en": "Payment method unavailable / missing", "note_zh": "支付方式不可用或不存在", "note_en": "The payment method is unavailable or does not exist"}, {"code": "300402", "http": 200, "retryable": "yes", "meaning_zh": "支付方式配置不可用", "meaning_en": "Payment method configuration unavailable", "note_zh": "当前请求未匹配到有效配置;修改参数或稍后重试", "note_en": "No valid configuration matched the request; change parameters or retry later"}, {"code": "300403", "http": 200, "retryable": "no", "meaning_zh": "费率未配置", "meaning_en": "Fee rate not configured", "note_zh": "联系服务商配置费率后重试", "note_en": "Contact your service provider to configure the fee rate, then retry"}, {"code": "300404", "http": 200, "retryable": "yes", "meaning_zh": "当前条件下无可用支付方式", "meaning_en": "No payment method is available for the request", "note_zh": "country + currency + pay_method 未匹配到启用分组;核对参数或联系运营开通", "note_en": "country + currency + pay_method matched no enabled group; check the parameters or contact operations to enable one"}, {"code": "300405", "http": 200, "retryable": "no", "meaning_zh": "缺少必要附加信息(extra.customer)", "meaning_en": "Missing required extra info (extra.customer)", "note_zh": "请按 `data.missing_fields` 补齐 extra.customer 中的字段", "note_en": "Fill the fields listed in `data.missing_fields` under extra.customer"}, {"code": "300406", "http": 200, "retryable": "no", "meaning_zh": "缺少必要下单参数(如 bank_code)", "meaning_en": "Missing required order parameter (e.g. bank_code)", "note_zh": "补齐该路由必填字段后重试", "note_en": "Fill the required field for that route and retry"}, {"code": "300407", "http": 200, "retryable": "no", "meaning_zh": "银行编码非法", "meaning_en": "Invalid bank code", "note_zh": "用「查询可用银行」(payout/banks/query) 返回的 code", "note_en": "Use a code returned by Query Available Banks (payout/banks/query)"}, {"code": "300408", "http": 200, "retryable": "no", "meaning_zh": "当前支付方式不支持代付凭证查询", "meaning_en": "Payment method does not support payout proof query", "note_zh": "当前支付方式不支持凭证查询", "note_en": "The payment method does not support proof queries"}, {"code": "300409", "http": 200, "retryable": "yes", "meaning_zh": "代付凭证暂不可用", "meaning_en": "Payout proof temporarily unavailable", "note_zh": "订单未成功 / 凭证暂未生成 / 超出查询窗口;确认成功且在窗口内再试", "note_en": "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", "meaning_zh": "代付收据暂不可用(订单非 success)", "meaning_en": "Payout receipt temporarily unavailable (order not success)", "note_zh": "仅 status=success 的正式代付单支持收据。订单仍在处理中(pending)时可待成功后重试;订单已失败(failed)为终态请勿重试。测试环境统一返回不可重试的 300416", "note_en": "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", "meaning_zh": "收据生成失败", "meaning_en": "Receipt generation failed", "note_zh": "渲染异常;稍后重试", "note_en": "Rendering error; retry later"}, {"code": "300415", "http": 200, "retryable": "no", "meaning_zh": "代收上游建单失败(订单已置 failed)", "meaning_en": "Collection upstream creation failed (order set to failed)", "note_zh": "订单已被平台落库并实时置为 failed,原 out_order_no 已占用;勿用同一 out_order_no 重试,请更换新 out_order_no 后重新下单", "note_en": "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", "meaning_zh": "当前环境或支付方式不支持代付收据查询", "meaning_en": "Payout receipt query is not supported in this environment or payment method", "note_zh": "例如使用测试环境密钥(env=test)查询收据时恒返回本码(与凭证接口 300408 对齐);不可重试,请勿轮询", "note_en": "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", "meaning_zh": "余额不足", "meaning_en": "Insufficient balance", "note_zh": "商户可用余额 < 冻结额(amount + fee);充值后重试", "note_en": "Available balance < frozen amount (amount + fee); top up and retry"}, ]