← Back to Skills Marketplace
codecodeing

Huifu DouGong HostingPay Cashier Preorder

by 青衫墨痕 · GitHub ↗ · v1.0.5 · MIT-0
cross-platform ✓ Security Clean
307
Downloads
3
Stars
0
Active Installs
6
Versions
Install in OpenClaw
/install huifu-dougong-hostingpay-cashier-preorder
Description
汇付支付斗拱统一收银台预下单 Skill:覆盖 H5/PC、支付宝小程序、微信小程序三种预下单场景。参数表和业务规则按协议字段组织,Java SDK 调用方式放在语言适配入口里。当开发者需要创建托管支付订单时使用。触发词:托管预下单、收银台预下单、H5支付、小程序支付、创建托管订单。
README (SKILL.md)

版权声明:本 Skill 内容来源于上海汇付支付有限公司官方开放平台文档,版权归属上海汇付支付有限公司。如有疑问可咨询汇付支付客服:400-820-2819 / [email protected]

Source: Official Open Platform documentation of Shanghai Huifu Payment Co., Ltd.

Copyright: Shanghai Huifu Payment Co., Ltd.


统一收银台 - 预下单

覆盖三种预下单场景:H5/PC、支付宝小程序、微信小程序。

适配版本与复核信息

项目 内容
Skill 版本 1.1.0
当前适配 SDK dg-java-sdk 3.0.34
最后复核日期 2026-04-08
官方文档来源 汇付开放平台托管支付预下单接口文档、Java SDK 文档、加验签说明、异步消息说明

运行依赖与凭据边界

本 Skill 依赖 huifu-dougong-hostingpay-base 提供公共运行时。凭据使用规则与存放边界见 credential-boundary.md

本文中出现的 signcert_nodownload_url 等示例值均为占位写法或字段名说明,不提供真实签名串、密文证件号或可复用下载地址。

前置依赖:首次接入请先阅读 huifu-dougong-hostingpay-base 完成 SDK 初始化。

开发前先补两步:先核对 客户前置准备清单,再按 参数校验与 JSON 构造规范 建模。像 project_idnotify_urlcallback_urlsub_openiddevs_id 这类值都不应由模型猜测。

官方产品文档补充约束:托管支付接入前还要完成控台项目创建、支付方式启用、费率配置、授权绑定和应用 ID 获取。hosting_data.project_idminiapp_data.seq_idsplit_pay_flag 对应权限、notify_url 合规性,都有明确的业务前置条件,不是只靠接口参数就能补出来的。

协议规则入口

这份 Skill 主要讲预下单场景。
真正跨语言共用的协议规则,统一看共享资料:

语言适配入口

这份 Skill 里的参数表、场景路由和状态说明,都是语言无关的。
具体语言怎么初始化 SDK、怎么发请求,先看这里:

前端如果要渲染托管收银台,不在这里做,直接看:

端到端支付流程

完整的支付链路包含 5 个阶段,开发者需理解全流程后再接入各接口:

[1] 预下单 (本 Skill)
  -> [2] 用户支付 (前端跳转)
  -> [3] 异步通知 (回调 notify)
  -> [4] 查询确认 (二次校验)
  -> [5] 退款 (可选)

步骤 1:预下单(本 Skill)

调用 v2/trade/hosting/payment/preorder 获得 jump_url,同时保存 req_seq_idreq_date(后续所有操作都需要)。

步骤 2:用户支付

  • 纯跳转模式:H5/PC 可以继续使用 window.location.href = jump_url 或 HTTP 302 直接跳转收银台
  • 前端自定义收银台模式:如果页面自己渲染支付入口,直接接 huifu-dougong-hostingpay-checkout-js,由前端通过 HFPaycreatePreOrder 拉起支付
  • 小程序模式:使用返回的 scheme_code 或 gh_id + path 拉起支付
  • 前后端对齐规则pre_order_type=1 对应 H5/PC,pre_order_type=2 对应支付宝小程序,pre_order_type=3 对应微信小程序
  • 支付完成后的页面回跳只代表前端流程结束,不代表后端可以直接把订单改成成功

步骤 3:接收异步通知

汇付将交易结果 POST 到 notify_url,关键要点:

步骤 4:二次查询确认

即使收到异步通知,仍建议调用查询接口做二次确认:

  • 接口:v2/trade/hosting/payment/queryorderinfo(见 huifu-dougong-hostingpay-cashier-query
  • 当同步返回 trans_stat=P(处理中)时,启动轮询:间隔 5 秒,最多 30 次
  • 若 150 秒后仍为 P,记录异常日志并人工介入,不要自动关单
  • 这一点与官方托管产品文档一致:前端回调和异步通知都不能替代关键业务环节的主动查询确认

步骤 5:退款(可选)

trans_stat=S 后需退款:


触发词

  • "预下单"、"支付预下单"、"创建订单"、"下单接口"
  • "H5 支付"、"PC 支付"、"H5 预下单"
  • "支付宝小程序支付"、"支付宝小程序预下单"
  • "微信小程序支付"、"微信小程序预下单"

场景路由

根据用户支付方式选择对应场景:

用户意图 场景 pre_order_type 详细说明
H5/PC 网页支付 H5/PC 预下单 1 h5-pc-preorder.md
支付宝小程序支付 支付宝小程序预下单 2 alipay-mini-preorder.md
微信小程序支付 微信小程序预下单 3 wechat-mini-preorder.md

官方前置条件

场景 开发前必须完成什么 关键值
H5 / PC 在合作伙伴控台创建托管项目、启用支付方式、记录 project_id hosting_data.project_id
H5 / PC 微信支付 先配置微信授权域名 api.huifu.com/hostingH5/ 微信支付可用性
微信小程序 完成小程序托管授权、代码发布、绑定 appid 生成应用 ID,并开通微信支付产品 / 费率 miniapp_data.seq_id
微信小程序拆单支付 先特批并开通拆单支付权限 split_pay_flag
支付宝小程序 开通托管支付权限并配置支付宝费率 app_dataalipay_data
全场景异步通知 准备公网可达且满足官方约束的 notify_url notify_url

H5/PC 参考文档索引

  • 总览与示例:references/h5-pc-preorder.md
  • 顶层请求参数:references/h5-pc-preorder-request.md
  • 渠道扩展请求参数:references/h5-pc-preorder-channel.md
  • 顶层同步/异步返回:references/h5-pc-preorder-response.md
  • 渠道扩展返回参数:references/h5-pc-preorder-response-channel.md
  • 错误码与排查:references/h5-pc-preorder-errors.md

汇付 API 端点

属性
API 路径 v2/trade/hosting/payment/preorder
请求方式 POST
Content-Type application/json

通用架构

三种预下单场景共享分层架构:

接口层
  +- 接收前端或业务系统的预下单请求
  +- 校验商户号、金额、商品描述、项目参数、回调地址

业务逻辑层
  +- 根据 pre_order_type 选择对应的预下单场景
  +- 组装托管支付请求报文
  +- 调用对应语言 SDK 或 HTTP 客户端发起 `v2/trade/hosting/payment/preorder`
  +- 保存 req_seq_id / req_date / pre_order_id 供查单和退款复用

请求对象
  |- huifu_id
  |- trans_amt
  |- goods_desc
  |- pre_order_type
  |- notify_url
  +- hosting_data / app_data / miniapp_data 等对象字段

下面出现的 SDK Request 类名,是 Java 适配层的写法。
如果你不是 Java 项目,参数结构仍按本 Skill 的协议字段来实现。

通用请求参数

参数 类型 必填 说明
huifu_id String(32) Y 商户号
req_date String(8) Y 请求日期 yyyyMMdd(SDK 自动生成)
req_seq_id String(64) Y 请求流水号(SDK 自动生成)
pre_order_type String(1) Y 1=H5/PC、2=支付宝小程序、3=微信小程序
trans_amt String(14) Y 交易金额,单位元,保留两位小数,最低 0.01
goods_desc String(40) Y 商品描述
delay_acct_flag String(1) N 是否延迟入账,Y=延迟、N=不延迟,默认 N
notify_url String(512) N 异步通知地址
time_expire String(14) N 交易失效时间 yyyyMMddHHmmss,默认 10 分钟
fee_sign String(32) N 手续费场景标识码

通用同步返回参数

以下为三种预下单场景都会返回的公共字段;场景差异字段见各自 reference。

参数 类型 说明
resp_code String(8) 接口受理返回码,用于排查;订单终态仍看 trans_stat、异步通知和查询结果
resp_desc String(128) 业务响应信息
req_date String(8) 请求日期,原样返回
req_seq_id String(64) 请求流水号,原样返回
huifu_id String(32) 商户号,原样返回

场景差异字段:

  • H5/PC:pre_order_idjump_urlhosting_datacurrent_timetime_expire
  • 支付宝小程序:trans_amtjump_url
  • 微信小程序:trans_amtpre_order_idminiapp_data

重要:调用成功后务必保存 req_seq_idreq_date,后续查询、退款、关单均需使用。

异步通知参数(三种场景通用)

交易完成后汇付异步回调 notify_url,关键字段:

参数 类型 说明
resp_code String(8) 业务返回码
resp_desc String(512) 业务返回描述
huifu_id String(32) 商户号
req_date String(8) 请求日期
req_seq_id String(64) 请求流水号
hf_seq_id String(40) 汇付全局流水号
trans_type String(20) 交易类型(T_MINIAPP/A_JSAPI 等)
trans_amt String(12) 交易金额
trans_stat String(1) 交易状态:S=成功、F=失败
is_div String(1) 是否分账交易
is_delay_acct String(1) 是否延迟交易

其余异步扩展字段(如 wx_responsealipay_responseunionpay_responsedy_responsebank_extend_param)按具体场景查看对应 reference。

SDK Request 类对照

预下单类型 SDK Request 类 差异化专属字段
H5/PC (type=1) V2TradeHostingPaymentPreorderH5Request hostingData
支付宝小程序 (type=2) V2TradeHostingPaymentPreorderAliRequest appData
微信小程序 (type=3) V2TradeHostingPaymentPreorderWxRequest miniappData

常见错误与排查

错误码 原因 排查方法
99010002 预下单请求流水重复 使用新的 req_seq_idSequenceTools.getReqSeqId32() 自动生成
10000000 无效参数 检查 huifu_idtrans_amtgoods_desc 等必填项格式
90000000 交易受限 / 微信 Scheme 生成失败 查看 resp_desc 详情,Scheme 失败需重新配置小程序

网络/系统错误:未收到响应或超时时,调用查询接口确认状态,切勿直接判定为失败。

快速接入代码示例见 quickstart.md


版权声明与联系方式见 copyright-notice.md

Usage Guidance
This Skill is a documentation/integration guide for Huifu's preorder API and appears coherent with that purpose. Before installing: (1) confirm you trust the skill source/homepage and that you intended to integrate with Huifu; (2) review the referenced base Skill (huifu-dougong-hostingpay-base) to see how signing is implemented and where your RSA private key will be used; (3) never place HUIFU_RSA_PRIVATE_KEY in client-side code or public repositories — keep it in a secure secret store and follow key rotation practices; (4) ensure the notify_url/callback_url you provide meets Huifu's constraints and is only reachable by expected parties; (5) note the metadata inconsistency where the registry says no env vars but SKILL.md lists required config keys — treat the SKILL.md list as authoritative and verify your deployment supplies those secrets securely.
Capability Analysis
Type: OpenClaw Skill Name: huifu-dougong-hostingpay-cashier-preorder Version: 1.0.5 This skill bundle provides comprehensive documentation and integration instructions for the Huifu Payment (汇付支付) unified cashier pre-order API, covering H5, PC, and mini-program scenarios. The content consists of legitimate API specifications, parameter mappings, and standard Java SDK code snippets aligned with the official Huifu Paas platform (paas.huifu.com). No evidence of malicious behavior, such as data exfiltration, unauthorized command execution, or harmful prompt injection, was detected.
Capability Tags
cryptocan-make-purchases
Capability Assessment
Purpose & Capability
Name/description match the content: the Skill is a language-agnostic integration guide for Huifu preorder (H5/PC, Alipay mini, WeChat mini). The required config entries (product id, sys id, RSA keys, notify/callback, project id/title) are appropriate for server-side signing and Huifu integration. Minor metadata mismatch: the registry summary shows "Required env vars: none" while SKILL.md lists required config keys; this appears to be a packaging/metadata inconsistency rather than malicious.
Instruction Scope
SKILL.md contains API endpoint URLs, request/response fields, code examples and integration rules and does not instruct the agent to read unrelated files, exfiltrate secrets, or call unexpected endpoints. It repeatedly warns not to guess runtime values and points to a base Skill for signing logic.
Install Mechanism
Instruction-only skill with no install spec and no downloaded code; nothing is written to disk by an installer. This is the lowest-risk install mechanism.
Credentials
Requested config keys (HUIFU_PRODUCT_ID, HUIFU_SYS_ID, HUIFU_RSA_PRIVATE_KEY, HUIFU_RSA_PUBLIC_KEY, HUIFU_NOTIFY_URL, HUIFU_PROJECT_ID, HUIFU_PROJECT_TITLE, HUIFU_CALLBACK_URL) are reasonable and proportionate for a server-side payment integration that must sign requests and expose notify/callback URLs. Note: HUIFU_RSA_PRIVATE_KEY is highly sensitive — providing it grants the ability to produce valid signed requests, so it must be stored and handled securely by the host environment.
Persistence & Privilege
Skill does not request always:true and is user-invocable only; it does not request system-wide config changes. Autonomous invocation is allowed by default but is typical for skills and not, by itself, a red flag here.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install huifu-dougong-hostingpay-cashier-preorder
  3. After installation, invoke the skill by name or use /huifu-dougong-hostingpay-cashier-preorder
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.5
huifu-dougong-hostingpay-cashier-preorder 1.1.0 introduces a new skill name and improved modular documentation. - Skill 名称、依赖与 License 调整,更好区分“托管支付”产品与相关基础模块。 - 文档结构优化,协议规则、语言入口、SDK 方法和参数表分层描述,便于跨语言接入。 - Java/多语言适配说明提取至专用入口;公共协议标注交由 shared-base 管理。 - 增加版本、SDK 适配及文档复核信息区;License 改为 CC-BY-NC-4.0。 - 不涉及接口/字段变更,仅为功能文档和引用路径规范性升级。
v1.0.4
- 修改作者信息为“jiaxiang.li” - 略微调整描述文字和排版,使文档条理更清晰 - 修改流程图为更简洁的文本流程 - 未涉及功能、接口或依赖项的变更 - 版权声明部分格式修订,补充开放平台链接 (未检测到实际功能或接口行为的变化,仅为文档优化和作者信息调整)
v1.0.3
## v1.0.3 Changelog - Metadata in SKILL.md updated: added `display_name`, `homepage`, and clarified author info; dependency/compatibility lists improved. - Documented more precise credential boundary and SDK/runtime expectations. - No code changes; update is documentation and metadata only.
v1.0.2
- No changes detected in this version. - SKILL.md and all files remain unchanged from previous release.
v1.0.1
huifu-dougong-hostingpay-cashier-preorder 1.0.1 - Added structured Openclaw metadata: now includes required bins and detailed config variables (`HUIFU_PRODUCT_ID`, `HUIFU_SYS_ID`, etc.). - Moved all environment variables into the Openclaw metadata section for consistency. - Added explicit copyright/attribution blocks at the top and bottom of the documentation for improved legal/source clarity. - No changes were made to code or runtime logic; documentation and metadata only.
v1.0.0
Initial release: Adds托管支付收银台退款申请与退款查询功能。 - 支持针对托管订单发起退款与查询退款状态,包括 API 路由和常见出错说明 - 明确参数填写与字段映射,特别强调原交易流水号(org_req_seq_id)的正确填法及常见编译误区 - 提供详细请求/返回参数说明、全流程时序图与错误排查指引 - 兼容 Java 8+,适用于 Spring Boot 2.x/3.x,依赖 dougong-hostingpay-pay-base - 附带完整场景路由、触发词、常见渠道退款期限、业务注意事项总结
Metadata
Slug huifu-dougong-hostingpay-cashier-preorder
Version 1.0.5
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 6
Frequently Asked Questions

What is Huifu DouGong HostingPay Cashier Preorder?

汇付支付斗拱统一收银台预下单 Skill:覆盖 H5/PC、支付宝小程序、微信小程序三种预下单场景。参数表和业务规则按协议字段组织,Java SDK 调用方式放在语言适配入口里。当开发者需要创建托管支付订单时使用。触发词:托管预下单、收银台预下单、H5支付、小程序支付、创建托管订单。 It is an AI Agent Skill for Claude Code / OpenClaw, with 307 downloads so far.

How do I install Huifu DouGong HostingPay Cashier Preorder?

Run "/install huifu-dougong-hostingpay-cashier-preorder" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Huifu DouGong HostingPay Cashier Preorder free?

Yes, Huifu DouGong HostingPay Cashier Preorder is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Huifu DouGong HostingPay Cashier Preorder support?

Huifu DouGong HostingPay Cashier Preorder is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Huifu DouGong HostingPay Cashier Preorder?

It is built and maintained by 青衫墨痕 (@codecodeing); the current version is v1.0.5.

💬 Comments