{
  "openapi": "3.0.3",
  "info": {
    "title": "商户支付接入API",
    "description": "pay-webman 支付系统对外接口文档\n\n## 概述\n\n本系统提供支付（代收）和代付（提现）两大类 API 接口，采用表单格式通信。\n\n## 签名算法\n\n- **表单 API 签名**：MD5 小写，固定顺序，`&{apikey}` 拼接\n- **代付表单 API 签名**：MD5 小写，ksort 排序，`key={apikey}` 拼接\n\n## 金额单位\n\n- 表单 API：元（支持小数）",
    "version": "1.0.0",
    "contact": {
      "name": "技术支持",
      "url": "/apidoc"
    }
  },
  "servers": [],
  "tags": [
    {
      "name": "支付API-表单",
      "description": "表单格式支付（代收）接口，签名算法为 MD5 小写固定顺序"
    },
    {
      "name": "代付API-表单",
      "description": "表单格式代付（提现）接口，签名算法为 MD5 小写 ksort"
    },
    {
      "name": "异步通知",
      "description": "支付成功后平台主动推送到商户的通知接口"
    }
  ],
  "paths": {
    "/apisubmit": {
      "post": {
        "tags": ["支付API-表单"],
        "summary": "表单支付下单",
        "description": "通过表单提交支付订单。金额单位为元（支持小数）。\n\n**签名算法**：表单 API 签名（MD5 小写，固定顺序）\n\n**签名串格式**：`version=1.0&customerid=10000&total_fee=100.00&sdorderno=...&notifyurl=...&returnurl=...&{apikey}`\n\n**响应规则**：\n- 带 `cardnum` 参数：返回 JSON `{\"code\":200,\"payurl\":\"...\"}`\n- 不带 `cardnum` 参数：返回纯文本支付链接",
        "operationId": "apiSubmit",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FormPayRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应（JSON 或纯文本）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormPayJsonResponse"
                },
                "examples": {
                  "成功（带cardnum）": {
                    "value": "{\"code\": 200, \"payurl\": \"https://openapi.alipay.com/gateway.do?...\"}"
                  },
                  "失败": {
                    "value": "{\"code\": 205, \"msg\": \"订单号已存在\"}"
                  }
                }
              },
              "text/plain": {
                "examples": {
                  "成功（不带cardnum）": {
                    "value": "https://openapi.alipay.com/gateway.do?..."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/pay/query/order": {
      "post": {
        "tags": ["支付API-表单"],
        "summary": "表单订单查询",
        "description": "通过表单查询支付订单状态。\n\n**签名算法**：表单 API 签名（MD5 小写，固定顺序）\n\n**签名串格式**：`version=&customerid=10000&total_fee=&sdorderno=ORDER202606170001&notifyurl=&returnurl=&{apikey}`\n\n**签名规则**：与下单签名格式相同，但 `version`、`total_fee`、`notifyurl`、`returnurl` 参数留空（传空字符串），仅 `customerid` 和 `sdorderno` 参与签名。MD5 后取小写。若使用 `orderid` 参数代替 `sdorderno`，签名时仍按 `sdorderno={订单号}` 拼接。\n\n**响应说明**：响应为 JSON 格式，不参与签名（通过 HTTPS 传输保证安全）。",
        "operationId": "formPayQuery",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FormPayQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormPayQueryResponse"
                },
                "examples": {
                  "成功": {
                    "value": "{\"code\": 200, \"orderid\": \"ORDER202606170001\", \"total_fee\": \"100.00\", \"pay_status\": \"1\", \"addtime\": \"1718600000\"}"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/apidai": {
      "post": {
        "tags": ["代付API-表单"],
        "summary": "表单代付下单",
        "description": "通过表单提交代付（提现）订单。金额单位为元（支持小数）。\n\n**签名算法**：代付表单 API 签名（MD5 小写，ksort）\n\n**签名串格式**：`customerid=10000&dai_no=...&total_money=100.00&version=1.0&key={apikey}`（ksort 排序后拼接，每个参数后带 `&`）",
        "operationId": "apiDai",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FormCashPaymentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormCashPaymentResponse"
                },
                "examples": {
                  "成功": {
                    "value": "{\"customerid\": \"10000\", \"dai_no\": \"DEPOSIT202606170001\", \"serialno_state\": \"SUCCESS\", \"charge\": \"0.00\", \"account\": \"advance\", \"total_money\": \"100.00\", \"tfb_rsptime\": \"1718600000\", \"sign\": \"a1b2c3d4e5f67890abcdef1234567890\"}"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/apidai/api_query": {
      "post": {
        "tags": ["代付API-表单"],
        "summary": "表单代付查询",
        "description": "通过表单查询代付订单状态。\n\n**签名算法**：代付表单 API 签名（MD5 小写，ksort）\n\n**签名串格式**：`aisle=abc&customerid=10000&dai_no=DEPOSIT202606170001&key={apikey}`（非空参数按 key 升序排列，每个参数后带 `&`，末尾拼接 `key={apikey}`，MD5 小写）\n\n**响应签名**：响应 JSON 中 `sign` 字段使用相同代付表单签名算法对响应正文（`customerid/dai_no/serialno_state/charge/tfb_rsptime/account/total_money` 等非空字段）加签，MD5 小写。",
        "operationId": "apiDaiQuery",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FormCashQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormCashPaymentResponse"
                },
                "examples": {
                  "成功": {
                    "value": "{\"customerid\": \"10000\", \"dai_no\": \"DEPOSIT202606170001\", \"serialno_state\": \"SUCCESS\", \"charge\": \"0.00\", \"account\": \"advance\", \"total_money\": \"100.00\", \"tfb_rsptime\": \"1718600000\", \"sign\": \"a1b2c3d4e5f67890abcdef1234567890\"}"
                  },
                  "失败": {
                    "value": "{\"retcode\": \"ORDERNOTEXIST\", \"retmsg\": \"此代付订单不存在\"}"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/apidai/balance_query": {
      "post": {
        "tags": ["代付API-表单"],
        "summary": "表单余额查询",
        "description": "通过表单查询商户可用余额。\n\n**签名算法**：代付表单 API 签名（MD5 小写，ksort）\n\n**签名串格式**：`aisle=abc&customerid=10000&key={apikey}`（非空参数按 key 升序排列，每个参数后带 `&`，末尾拼接 `key={apikey}`，MD5 小写）\n\n**响应签名**：响应 JSON 中 `sign` 字段使用相同代付表单签名算法对响应正文（`customerid/retcode/retmsg/advance/fund/freeze` 等非空字段）加签，MD5 小写。",
        "operationId": "apiDaiBalance",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/FormCashBalanceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormCashBalanceResponse"
                },
                "examples": {
                  "成功": {
                    "value": "{\"customerid\": \"10000\", \"retcode\": \"PASS\", \"retmsg\": \"查询成功\", \"advance\": \"10000.00\", \"fund\": \"0\", \"freeze\": \"0\", \"sign\": \"a1b2c3d4e5f67890abcdef1234567890\"}"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/notify/callback": {
      "post": {
        "tags": ["异步通知"],
        "summary": "支付成功异步通知（商户接收）",
        "description": "支付成功后，平台主动 POST 推送到商户配置的 notify_url。\n\n**推送方式**：HTTP POST，Content-Type: application/json\n\n**签名算法**：固定顺序拼接（customerid→status→sdpayno→sdorderno→total_fee→paytype），末尾直接拼接 `&{apikey}`，MD5 小写。\n\n**签名原串**：`customerid={customerid}&status={status}&sdpayno={sdpayno}&sdorderno={sdorderno}&total_fee={total_fee}&paytype={paytype}&{apikey}`\n\n**商户响应要求**：返回 `success`、`ok` 或 `200`（不区分大小写），HTTP 200\n\n**重试机制**：最多 6 次（含首次），间隔 30/60/120/240/480 秒\n\n**注意**：total_fee 单位为**元**，不是分。",
        "operationId": "notifyCallback",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotifyRequest"
              },
              "examples": {
                "通知报文": {
                  "value": "{\n  \"customerid\": \"10000\",\n  \"status\": \"1\",\n  \"sdpayno\": \"PLT202606171234567890\",\n  \"sdorderno\": \"ORDER202606170001\",\n  \"total_fee\": \"100.00\",\n  \"paytype\": \"Alipay\",\n  \"sign\": \"a1b2c3d4e5f67890abcdef1234567890\"\n}"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "商户需返回 success/ok/200 字样",
            "content": {
              "text/plain": {
                "examples": {
                  "正确响应": {
                    "value": "success"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pay/payment": {
      "post": {
        "tags": ["代收API-XML"],
        "summary": "XML 代收下单",
        "description": "通过 XML 格式提交支付订单，兼容旧版 `/gateway/payment`。\n\n**Content-Type**: text/xml\n\n**签名算法**：XML API 签名（ksort + key=value& + &key= + MD5 **大写**）\n\n**签名原串**：将除 sign 外所有非空参数按 key 升序排列，拼接为 `key1=value1&key2=value2&...&key={apikey}`，MD5 后取**大写**。\n\n**注意**：total_fee 单位为**元**，必须是整数（不支持小数，即不支持角分）。",
        "operationId": "xmlPayPayment",
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": { "$ref": "#/components/schemas/XmlPayPaymentRequest" },
              "examples": {
                "请求报文": {
                  "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><orderid>ORDER202606170001</orderid><total_fee>100</total_fee><trade_type>alipay</trade_type><notify_url>https://yourdomain.com/notify</notify_url><return_url>https://yourdomain.com/return</return_url><nonce_str>abc123def456</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "XML 响应",
            "content": {
              "text/xml": {
                "schema": { "$ref": "#/components/schemas/XmlPayPaymentResponse" },
                "examples": {
                  "成功": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retCode>SUCCESS</retCode><orderid>PLT202606171234567890</orderid><payurl>https://openapi.alipay.com/gateway.do?...</payurl></xml>" },
                  "失败": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retCode>1014</retCode><retMsg>参数不完整</retMsg></xml>" }
                }
              }
            }
          }
        }
      }
    },
    "/pay/api_query": {
      "post": {
        "tags": ["代收API-XML"],
        "summary": "XML 代收订单查询",
        "description": "通过 XML 格式查询代收订单状态，兼容旧版路径。\n\n**Content-Type**: text/xml\n\n**签名算法**：XML API 签名（ksort + key=value& + &key= + MD5 **大写**）\n\n**签名原串**：将除 sign 外所有非空参数按 key 升序排列，拼接为 `customerid=10000&nonce_str=abc123def456&orderid=ORDER202606170001&key={apikey}`，MD5 后取**大写**。\n\n**请求参数**：`customerid`（商户号）、`orderid`（商户订单号）、`nonce_str`（随机字符串）、`sign`（签名值）。\n\n**响应签名**：响应 XML 中 `<sign>` 字段使用相同 XML API 签名算法对响应正文（`customerid/orderid/total_fee/pay_status/time`）加签，MD5 大写。商户收到响应后应使用相同规则验签。",
        "operationId": "xmlPayQuery",
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": { "$ref": "#/components/schemas/XmlPayQueryRequest" },
              "examples": {
                "请求报文": {
                  "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><orderid>ORDER202606170001</orderid><nonce_str>abc123def456</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "XML 响应",
            "content": {
              "text/xml": {
                "schema": { "$ref": "#/components/schemas/XmlPayQueryResponse" },
                "examples": {
                  "成功": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><orderid>ORDER202606170001</orderid><total_fee>100</total_fee><pay_status>1</pay_status><time>1718600000</time><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>" },
                  "失败": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retCode>1027</retCode><retMsg>此订单不存在</retMsg></xml>" }
                }
              }
            }
          }
        }
      }
    },
    "/cash/payment": {
      "post": {
        "tags": ["代付API-XML"],
        "summary": "XML 代付下单",
        "description": "通过 XML 格式提交代付订单。\n\n**Content-Type**: text/xml\n\n**签名算法**：XML API 签名（ksort + key=value& + &key= + MD5 **大写**）\n\n**注意**：money 单位为**元**，必须是整数（不支持小数）。",
        "operationId": "xmlCashPayment",
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": { "$ref": "#/components/schemas/XmlCashPaymentRequest" },
              "examples": {
                "请求报文": {
                  "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><orderid>DEPOSIT202606170001</orderid><money>100</money><bankname>中国工商银行</bankname><cnaps_name>中国工商银行</cnaps_name><recv_accno>6222020000000000000</recv_accno><acct_name>张三</acct_name><recv_province>广东省</recv_province><recv_city>深圳市</recv_city><nonce_str>abc123def456</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "XML 响应",
            "content": {
              "text/xml": {
                "examples": {
                  "成功": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retmsg>响应成功</retmsg><retcode>00</retcode><data><customerid>10000</customerid><is_state>0</is_state><money>100.00</money><nonce_str>xyz789</nonce_str><orderid>DEPOSIT202606170001</orderid><time>1718600000</time><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></data></xml>" },
                  "失败": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retCode>1054</retCode><retMsg>订单号已存在</retMsg></xml>" }
                }
              }
            }
          }
        }
      }
    },
    "/cash/query": {
      "post": {
        "tags": ["代付API-XML"],
        "summary": "XML 代付订单查询",
        "description": "通过 XML 格式查询代付订单状态。\n\n**Content-Type**: text/xml\n\n**签名算法**：XML API 签名（ksort + key=value& + &key= + MD5 **大写**）\n\n**签名原串**：将除 sign 外所有非空参数按 key 升序排列，拼接为 `customerid=10000&nonce_str=abc123def456&orderid=DEPOSIT202606170001&key={apikey}`，MD5 后取**大写**。\n\n**响应签名**：响应 XML 中 `<sign>` 字段使用相同 XML API 签名算法对 `<data>` 内非空字段加签，MD5 大写。",
        "operationId": "xmlCashQuery",
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": { "$ref": "#/components/schemas/XmlCashQueryRequest" },
              "examples": {
                "请求报文": {
                  "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><orderid>DEPOSIT202606170001</orderid><nonce_str>abc123def456</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "XML 响应",
            "content": {
              "text/xml": {
                "examples": {
                  "成功": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retmsg>查询成功</retmsg><retcode>00</retcode><data><customerid>10000</customerid><is_state>1</is_state><money>100.00</money><nonce_str>xyz789</nonce_str><orderid>DEPOSIT202606170001</orderid><time>1718600000</time><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></data></xml>" },
                  "失败": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retCode>1027</retCode><retMsg>此订单不存在</retMsg></xml>" }
                }
              }
            }
          }
        }
      }
    },
    "/cash/balance": {
      "post": {
        "tags": ["代付API-XML"],
        "summary": "XML 余额查询",
        "description": "通过 XML 格式查询商户可用余额。\n\n**Content-Type**: text/xml\n\n**签名算法**：XML API 签名（ksort + key=value& + &key= + MD5 **大写**）\n\n**签名原串**：将除 sign 外所有非空参数按 key 升序排列，拼接为 `customerid=10000&nonce_str=abc123def456&key={apikey}`，MD5 后取**大写**。\n\n**响应签名**：响应 XML 中 `<sign>` 字段使用相同 XML API 签名算法对 `<data>` 内非空字段加签，MD5 大写。",
        "operationId": "xmlCashBalance",
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": { "$ref": "#/components/schemas/XmlCashBalanceRequest" },
              "examples": {
                "请求报文": {
                  "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><customerid>10000</customerid><nonce_str>abc123def456</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></xml>"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "XML 响应",
            "content": {
              "text/xml": {
                "examples": {
                  "成功": { "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><retmsg>查询成功</retmsg><retcode>00</retcode><data><advance>10000.00</advance><customerid>10000</customerid><freeze>0.00</freeze><nonce_str>xyz789</nonce_str><sign>A1B2C3D4E5F67890ABCDEF1234567890</sign></data></xml>" }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FormPayRequest": {
        "type": "object",
        "title": "表单支付下单请求",
        "properties": {
          "customerid": { "type": "integer", "description": "商户ID", "example": 10000 },
          "total_fee": { "type": "number", "description": "订单金额（单位：元，支持小数）", "example": 100.00 },
          "sdorderno": { "type": "string", "description": "商户订单号", "example": "ORDER202606170001" },
          "notifyurl": { "type": "string", "description": "异步通知地址", "example": "http://example.com/notify" },
          "returnurl": { "type": "string", "description": "同步跳转地址", "example": "http://example.com/return" },
          "paytype": { "type": "string", "description": "支付类型（Alipay/Weixin/Bank 等）", "example": "Alipay" },
          "sign": { "type": "string", "description": "签名值（MD5 小写）" },
          "version": { "type": "string", "description": "版本号（默认 1.0）", "example": "1.0", "default": "1.0" },
          "bankcode": { "type": "string", "description": "银行代码（paytype=Bank 时必填）" },
          "remark": { "type": "string", "description": "备注" },
          "cardnum": { "type": "string", "description": "卡号（存在时返回 JSON，否则返回纯文本 URL）" },
          "clientip": { "type": "string", "description": "付款人真实IP（IPv4/IPv6），商户服务端代为上送，不参与签名；合法时写库并透传需要该参数的上游通道，不传或格式非法时回退请求真实IP", "example": "192.168.1.100" },
          "clientuid": { "type": "string", "description": "付款用户在下游系统中的ID（1-128位，允许字母数字及 _-.:@|，兼容雪花/hash/UUID），不参与签名；合法时写库，不传存NULL，超长或非法按未传处理不阻断下单", "example": "1789727703123456789", "maxLength": 128 }
        },
        "required": ["customerid", "total_fee", "sdorderno", "notifyurl", "returnurl", "paytype", "sign"]
      },
      "FormPayJsonResponse": {
        "type": "object",
        "title": "表单支付下单响应（JSON）",
        "properties": {
          "code": { "type": "integer", "description": "200 表示成功，其他为错误码" },
          "payurl": { "type": "string", "description": "支付链接（成功时返回）" },
          "msg": { "type": "string", "description": "错误信息（失败时返回）" }
        }
      },
      "FormPayQueryRequest": {
        "type": "object",
        "title": "表单订单查询请求",
        "properties": {
          "customerid": { "type": "integer", "description": "商户ID", "example": 10000 },
          "sdorderno": { "type": "string", "description": "商户订单号（与 orderid 二选一）", "example": "ORDER202606170001" },
          "orderid": { "type": "string", "description": "商户订单号（与 sdorderno 二选一）" },
          "sign": { "type": "string", "description": "签名值（MD5 小写）" }
        },
        "required": ["customerid", "sign"]
      },
      "FormPayQueryResponse": {
        "type": "object",
        "title": "表单订单查询响应",
        "properties": {
          "code": { "type": "integer", "description": "200 表示成功" },
          "orderid": { "type": "string", "description": "商户订单号" },
          "total_fee": { "type": "string", "description": "订单金额（单位：元）" },
          "pay_status": { "type": "string", "description": "支付状态：0=未支付, 1=已支付" },
          "addtime": { "type": "string", "description": "下单时间戳" }
        }
      },
      "FormCashPaymentRequest": {
        "type": "object",
        "title": "表单代付下单请求",
        "properties": {
          "customerid": { "type": "integer", "description": "商户ID", "example": 10000 },
          "version": { "type": "string", "description": "版本号", "example": "1.0" },
          "dai_no": { "type": "string", "description": "代付订单号", "example": "DEPOSIT202606170001" },
          "total_money": { "type": "number", "description": "代付金额（单位：元）", "example": 100.00 },
          "recv_accno": { "type": "string", "description": "收款账号", "example": "6222021234567890123" },
          "acct_name": { "type": "string", "description": "收款人姓名", "example": "张三" },
          "cnaps_name": { "type": "string", "description": "联行号/支行名称", "example": "工行北京分行营业部" },
          "recv_province": { "type": "string", "description": "省份", "example": "北京" },
          "recv_city": { "type": "string", "description": "城市", "example": "北京市" },
          "code": { "type": "string", "description": "代付通道代码", "example": "abc" },
          "sign": { "type": "string", "description": "签名值（MD5 小写）" }
        },
        "required": ["customerid", "version", "dai_no", "total_money", "recv_accno", "acct_name", "cnaps_name", "recv_province", "recv_city", "code", "sign"]
      },
      "FormCashPaymentResponse": {
        "type": "object",
        "title": "表单代付响应",
        "properties": {
          "customerid": { "type": "string", "description": "商户ID" },
          "dai_no": { "type": "string", "description": "代付订单号" },
          "serialno_state": { "type": "string", "description": "代付状态：SUCCESS=成功, FAIL=失败, PEND=处理中" },
          "charge": { "type": "string", "description": "手续费（单位：元）" },
          "account": { "type": "string", "description": "扣款账户（advance=可用余额）" },
          "total_money": { "type": "string", "description": "代付金额（单位：元）" },
          "tfb_rsptime": { "type": "string", "description": "响应时间戳" },
          "sign": { "type": "string", "description": "响应签名（MD5 小写）" }
        }
      },
      "FormCashQueryRequest": {
        "type": "object",
        "title": "表单代付查询请求",
        "properties": {
          "customerid": { "type": "integer", "description": "商户ID", "example": 10000 },
          "dai_no": { "type": "string", "description": "代付订单号", "example": "DEPOSIT202606170001" },
          "aisle": { "type": "string", "description": "通道标识", "example": "abc" },
          "sign": { "type": "string", "description": "签名值（MD5 小写）" }
        },
        "required": ["customerid", "dai_no", "aisle", "sign"]
      },
      "FormCashBalanceRequest": {
        "type": "object",
        "title": "表单余额查询请求",
        "properties": {
          "customerid": { "type": "integer", "description": "商户ID", "example": 10000 },
          "aisle": { "type": "string", "description": "通道标识", "example": "abc" },
          "sign": { "type": "string", "description": "签名值（MD5 小写）" }
        },
        "required": ["customerid", "aisle", "sign"]
      },
      "FormCashBalanceResponse": {
        "type": "object",
        "title": "表单余额查询响应",
        "properties": {
          "customerid": { "type": "string", "description": "商户ID" },
          "retcode": { "type": "string", "description": "PASS=成功, FAIL=失败" },
          "retmsg": { "type": "string", "description": "响应信息" },
          "advance": { "type": "string", "description": "可用余额（单位：元）" },
          "fund": { "type": "string", "description": "资金（通常为 0）" },
          "freeze": { "type": "string", "description": "冻结金额（单位：元）" },
          "sign": { "type": "string", "description": "响应签名" }
        }
      },
      "NotifyRequest": {
        "type": "object",
        "title": "异步通知报文",
        "description": "平台推送到商户 notify_url 的支付结果通知（JSON格式）。签名算法：固定顺序拼接 customerid→status→sdpayno→sdorderno→total_fee→paytype，末尾拼接&{apikey}，MD5小写。total_fee单位为元。",
        "properties": {
          "customerid": { "type": "string", "description": "商户ID", "example": "10000" },
          "status": { "type": "string", "description": "支付状态：1=已支付", "example": "1" },
          "sdpayno": { "type": "string", "description": "平台订单号", "example": "PLT202606171234567890" },
          "sdorderno": { "type": "string", "description": "商户订单号", "example": "ORDER202606170001" },
          "total_fee": { "type": "string", "description": "订单金额（单位：元）", "example": "100.00" },
          "paytype": { "type": "string", "description": "支付类型（如Alipay/Weixin/Wxh5等）", "example": "Alipay" },
          "sign": { "type": "string", "description": "通知签名（MD5小写，固定顺序算法）" }
        },
        "required": ["customerid", "status", "sdpayno", "sdorderno", "total_fee", "paytype", "sign"]
      },
      "XmlPayPaymentRequest": {
        "type": "object",
        "title": "XML代收请求报文字段",
        "description": "XML报文中的字段，包裹在<xml>标签内",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "orderid": { "type": "string", "description": "商户订单号（唯一）" },
          "total_fee": { "type": "integer", "description": "订单金额，单位：元，必须为整数（不支持小数）" },
          "trade_type": { "type": "string", "description": "支付类型编码（如 alipay/wechat/alipaywap/wxh5/wxnative/bank 等）" },
          "notify_url": { "type": "string", "description": "异步通知地址（支持 HTTP/HTTPS，推荐 HTTPS）" },
          "return_url": { "type": "string", "description": "同步跳转地址" },
          "nonce_str": { "type": "string", "description": "随机字符串" },
          "bank_code": { "type": "string", "description": "银行编码（网银支付时必填）" },
          "subject": { "type": "string", "description": "订单标题" },
          "body": { "type": "string", "description": "订单描述" },
          "attach": { "type": "string", "description": "附加数据，原样返回" },
          "istype": { "type": "integer", "description": "支付方式类型，默认0" },
          "sign": { "type": "string", "description": "签名（MD5大写，ksort算法）" }
        },
        "required": ["customerid", "orderid", "total_fee", "trade_type", "notify_url", "nonce_str", "sign"]
      },
      "XmlPayPaymentResponse": {
        "type": "object",
        "title": "XML代收响应字段",
        "properties": {
          "retCode": { "type": "string", "description": "SUCCESS=成功，其他为错误码" },
          "orderid": { "type": "string", "description": "平台订单号（成功时返回）" },
          "payurl": { "type": "string", "description": "支付链接（成功时返回）" },
          "retMsg": { "type": "string", "description": "错误信息（失败时返回）" }
        }
      },
      "XmlPayQueryRequest": {
        "type": "object",
        "title": "XML代收查询请求字段",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "orderid": { "type": "string", "description": "商户订单号" },
          "nonce_str": { "type": "string", "description": "随机字符串" },
          "sign": { "type": "string", "description": "签名（MD5大写）" }
        },
        "required": ["customerid", "orderid", "nonce_str", "sign"]
      },
      "XmlPayQueryResponse": {
        "type": "object",
        "title": "XML代收查询响应字段",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "orderid": { "type": "string", "description": "商户订单号" },
          "total_fee": { "type": "string", "description": "订单金额（单位：元）" },
          "pay_status": { "type": "string", "description": "支付状态：0=未支付，1=已支付，2=失败" },
          "time": { "type": "string", "description": "响应时间戳" },
          "sign": { "type": "string", "description": "签名（MD5大写）" },
          "retCode": { "type": "string", "description": "错误码（失败时返回）" },
          "retMsg": { "type": "string", "description": "错误信息（失败时返回）" }
        }
      },
      "XmlCashPaymentRequest": {
        "type": "object",
        "title": "XML代付请求报文字段",
        "description": "XML报文中的字段，包裹在<xml>标签内",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "orderid": { "type": "string", "description": "代付订单号（唯一）" },
          "money": { "type": "integer", "description": "代付金额，单位：元，必须为整数（不支持小数）" },
          "bankname": { "type": "string", "description": "开户行名称" },
          "cnaps_name": { "type": "string", "description": "联行号/支行名称" },
          "recv_accno": { "type": "string", "description": "收款账号" },
          "acct_name": { "type": "string", "description": "收款人姓名" },
          "recv_province": { "type": "string", "description": "省份" },
          "recv_city": { "type": "string", "description": "城市" },
          "nonce_str": { "type": "string", "description": "随机字符串" },
          "sign": { "type": "string", "description": "签名（MD5大写，ksort算法）" }
        },
        "required": ["customerid", "orderid", "money", "bankname", "cnaps_name", "recv_accno", "acct_name", "recv_province", "recv_city", "nonce_str", "sign"]
      },
      "XmlCashQueryRequest": {
        "type": "object",
        "title": "XML代付查询请求字段",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "orderid": { "type": "string", "description": "代付订单号" },
          "nonce_str": { "type": "string", "description": "随机字符串" },
          "sign": { "type": "string", "description": "签名（MD5大写）" }
        },
        "required": ["customerid", "orderid", "nonce_str", "sign"]
      },
      "XmlCashBalanceRequest": {
        "type": "object",
        "title": "XML余额查询请求字段",
        "properties": {
          "customerid": { "type": "string", "description": "商户编号" },
          "nonce_str": { "type": "string", "description": "随机字符串" },
          "sign": { "type": "string", "description": "签名（MD5大写）" }
        },
        "required": ["customerid", "nonce_str", "sign"]
      }
    }
  }
}
