Files
device-voice-h5/docs/产品迭代8月份/支付.md
luo e82b0ab5da
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 4m41s
fix:微信支付
2026-09-23 09:32:48 +08:00

16 lines
15 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
* 二、C 端支付接口这些接口路径不变,但支付路由行为已变化:┌──────┬───────────────────────────┬───────────────────────────┐│ 方法 │ 接口 │ 用途 │├──────┼───────────────────────────┼───────────────────────────┤│ POST │ /api/c/v1/orders/create │ C 端套餐订单/强充订单创建 │├──────┼───────────────────────────┼───────────────────────────┤│ POST │ /api/c/v1/wallet/recharge │ C 端资产钱包充值 │└──────┴───────────────────────────┴───────────────────────────┘前端需要注意:
* 支付商户由商户池自动选择,前端不需要传商户 ID。
* 明确预下单失败时,当前支付失败,不会自动切换商户重试。
* 超时、连接中断等未知结果不会自动切换或重复创建支付。
* 金额/笔数轮询按支付创建尝试计入,不再只按支付成功计入。
* 原有错误码和错误提示仍以接口文档为准。
# 创建订单## OpenAPI Specification```yamlopenapi: 3.0.1info: title: '' description: '' version: 1.0.0paths: /api/c/v1/orders/create: post: summary: 创建订单 deprecated: false description: '' tags: - 个人客户 - 订单 - 个人客户 - 订单 parameters: [] requestBody: content: application/json: schema: $ref: '#/components/schemas/DtoClientCreateOrderRequest' responses: '200': description: 成功 content: application/json: schema: properties: code: description: 响应码 type: integer examples: - 0 data: $ref: '#/components/schemas/DtoClientCreateOrderResponse' msg: description: 响应消息 type: string examples: - success timestamp: description: 时间戳 format: date-time type: string required: - code - data - msg - timestamp type: object x-apifox-orders: - code - data - msg - timestamp x-apifox-ignore-properties: [] headers: {} x-apifox-name: '' '400': description: 请求参数错误 content: application/json: schema: &ref_0 $ref: '#/components/schemas/ErrorResponse' headers: {} x-apifox-name: '' '401': description: 未认证或认证已过期 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' '403': description: 无权访问 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' '500': description: 服务器内部错误 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' security: - BearerAuth: [] x-apifox: schemeGroups: - id: OdihZcUosHAGcYabPlrwh schemeIds: - BearerAuth required: true use: id: OdihZcUosHAGcYabPlrwh scopes: OdihZcUosHAGcYabPlrwh: BearerAuth: [] x-apifox-folder: 个人客户 - 订单 x-apifox-status: released x-run-in-apifox: https://app.apifox.com/web/project/7591618/apis/api-430306493-runcomponents: schemas: DtoClientCreateOrderRequest: properties: app_type: description: 应用类型(微信强充必传)(official_account:公众号, miniapp:小程序) type: string identifier: description: 资产标识符(SN/IMEI/虚拟号/ICCID/MSISDN) maxLength: 50 minLength: 1 type: string package_ids: description: 套餐ID列表 items: minimum: 0 type: integer type: array nullable: true payment_method: description: 订单支付方式 (wallet:钱包, wechat:微信, alipay:支付宝) type: string required: - identifier - package_ids - payment_method type: object x-apifox-orders: - app_type - identifier - package_ids - payment_method x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientCreateOrderResponse: properties: idempotent: description: 幂等标志(true 表示返回的是已存在的待支付充值订单) type: boolean linked_package_info: $ref: '#/components/schemas/DtoLinkedPackageInfo' order: $ref: '#/components/schemas/DtoClientOrderInfo' order_type: description: 订单类型 (package:套餐订单, recharge:充值订单) type: string pay_config: $ref: '#/components/schemas/DtoClientPayConfig' payment_link: $ref: '#/components/schemas/DtoClientPaymentLink' recharge: $ref: '#/components/schemas/DtoClientRechargeInfo' type: object x-apifox-orders: - idempotent - linked_package_info - order - order_type - pay_config - payment_link - recharge x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientRechargeInfo: properties: amount: description: 充值金额(分) type: integer auto_purchase_status: description: 自动购包状态 type: string recharge_id: description: 充值ID minimum: 0 type: integer recharge_no: description: 充值单号 type: string status: description: 状态 (0:待支付, 1:已支付, 2:已关闭) type: integer status_name: description: 状态名称(中文) type: string type: object x-apifox-orders: - amount - auto_purchase_status - recharge_id - recharge_no - status - status_name x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientPaymentLink: properties: copy_link: description: 复制到普通浏览器打开的支付链接(与 qr_link 相同) type: string pay_expire_at: description: 支付链接过期时间(RFC3339 格式) type: string payment_no: description: 支付单号 type: string qr_link: description: 二维码内容链接,前端用该链接生成二维码 type: string type: object x-apifox-orders: - copy_link - pay_expire_at - payment_no - qr_link x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientPayConfig: properties: app_id: description: 应用ID type: string nonce_str: description: 随机字符串 type: string package: description: 预支付参数 type: string pay_sign: description: 支付签名 type: string sign_type: description: 签名类型 type: string timestamp: description: 时间戳 type: string type: object x-apifox-orders: - app_id - nonce_str - package - pay_sign - sign_type - timestamp x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientOrderInfo: properties: created_at: description: 创建时间 type: string order_id: description: 订单ID minimum: 0 type: integer order_no: description: 订单号 type: string payment_method: description: 订单创建时选定的支付方式 (wallet:钱包, wechat:微信, alipay:支付宝) type: string payment_status: description: 支付状态 (1:待支付, 2:已支付, 3:已取消, 4:已退款) type: integer payment_status_name: description: 支付状态名称(中文) type: string total_amount: description: 订单总金额(分) type: integer type: object x-apifox-orders: - created_at - order_id - order_no - payment_method - payment_status - payment_status_name - total_amount x-apifox-ignore-properties: [] x-apifox-folder: '' DtoLinkedPackageInfo: properties: force_recharge_amount: description: 强制充值金额(分) type: integer package_names: description: 套餐名称列表 items: type: string type: array nullable: true total_package_amount: description: 套餐总金额(分) type: integer wallet_credit: description: 钱包抵扣金额(分) type: integer type: object x-apifox-orders: - force_recharge_amount - package_names - total_package_amount - wallet_credit x-apifox-ignore-properties: [] x-apifox-folder: '' ErrorResponse: properties: code: description: 错误码 type: integer examples: - 1001 data: description: 错误详情(可选) type: object x-apifox-orders: [] properties: {} x-apifox-ignore-properties: [] msg: description: 错误消息 type: string examples: - 参数验证失败 timestamp: description: 时间戳 format: date-time type: string required: - code - msg - timestamp type: object x-apifox-orders: - code - data - msg - timestamp x-apifox-ignore-properties: [] x-apifox-folder: '' securitySchemes: BearerAuth: bearerFormat: JWT scheme: bearer type: jwt AgentOpenAPIAccount: description: 代理账号标识,填写代理登录平台使用的用户名或手机号,例如 agent001。 in: header name: X-Agent-Account type: apikey AgentOpenAPINonce: description: 调用方每次请求自行生成的随机串,不需要平台提前分配;同一账号在 5 分钟内不可重复。 in: header name: X-Agent-Nonce type: apikey AgentOpenAPIPassword: description: 代理账号当前登录密码,同时作为 HMAC-SHA256 签名密钥;密码变更后必须使用新密码签名。 in: header name: X-Agent-Password type: apikey AgentOpenAPISign: description: 调用方按签名规则实时计算的 HMAC-SHA256 小写十六进制签名,不是固定值。 in: header name: X-Agent-Sign type: apikey AgentOpenAPITimestamp: description: 调用方生成的请求发起时间,支持 Unix 秒、Unix 毫秒或 RFC3339 时间,必须与签名原文 timestamp 行一致。 in: header name: X-Agent-Timestamp type: apikey Combination: group: - id: 1262265 - id: 1262266 - id: 1262267 - id: 1262268 - id: 1262269 type: combinationservers: - url: https://cmp-api.boss160.cn description: 测试环境security: []```
# 创建充值订单## OpenAPI Specification```yamlopenapi: 3.0.1info: title: '' description: '' version: 1.0.0paths: /api/c/v1/wallet/recharge: post: summary: 创建充值订单 deprecated: false description: '' tags: - 个人客户 - 钱包 - 个人客户 - 钱包 parameters: [] requestBody: content: application/json: schema: $ref: '#/components/schemas/DtoClientCreateRechargeRequest' responses: '200': description: 成功 content: application/json: schema: properties: code: description: 响应码 type: integer examples: - 0 data: $ref: '#/components/schemas/DtoClientRechargeResponse' msg: description: 响应消息 type: string examples: - success timestamp: description: 时间戳 format: date-time type: string required: - code - data - msg - timestamp type: object x-apifox-orders: - code - data - msg - timestamp x-apifox-ignore-properties: [] headers: {} x-apifox-name: '' '400': description: 请求参数错误 content: application/json: schema: &ref_0 $ref: '#/components/schemas/ErrorResponse' headers: {} x-apifox-name: '' '401': description: 未认证或认证已过期 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' '403': description: 无权访问 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' '500': description: 服务器内部错误 content: application/json: schema: *ref_0 headers: {} x-apifox-name: '' security: - BearerAuth: [] x-apifox: schemeGroups: - id: BaTDfS1rv5Zg6feGxUPR8 schemeIds: - BearerAuth required: true use: id: BaTDfS1rv5Zg6feGxUPR8 scopes: BaTDfS1rv5Zg6feGxUPR8: BearerAuth: [] x-apifox-folder: 个人客户 - 钱包 x-apifox-status: released x-run-in-apifox: https://app.apifox.com/web/project/7591618/apis/api-430306496-runcomponents: schemas: DtoClientCreateRechargeRequest: properties: amount: description: 充值金额(分) maximum: 10000000 minimum: 1 type: integer app_type: description: 应用类型(微信支付必传)(official_account:公众号, miniapp:小程序) type: string identifier: description: 资产标识符(SN/IMEI/虚拟号/ICCID/MSISDN) maxLength: 50 minLength: 1 type: string payment_method: description: 支付方式 (wechat:微信支付, alipay:支付宝) type: string required: - amount - identifier - payment_method type: object x-apifox-orders: - amount - app_type - identifier - payment_method x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientRechargeResponse: properties: pay_config: $ref: '#/components/schemas/DtoClientRechargePayConfig' payment_link: $ref: '#/components/schemas/DtoClientPaymentLink' recharge: $ref: '#/components/schemas/DtoClientRechargeResult' type: object x-apifox-orders: - pay_config - payment_link - recharge x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientRechargeResult: properties: amount: description: 充值金额(分) type: integer recharge_id: description: 充值ID minimum: 0 type: integer recharge_no: description: 充值单号 type: string status: description: 状态 (0:待支付, 1:已支付, 2:已关闭) type: integer type: object x-apifox-orders: - amount - recharge_id - recharge_no - status x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientPaymentLink: properties: copy_link: description: 复制到普通浏览器打开的支付链接(与 qr_link 相同) type: string pay_expire_at: description: 支付链接过期时间(RFC3339 格式) type: string payment_no: description: 支付单号 type: string qr_link: description: 二维码内容链接,前端用该链接生成二维码 type: string type: object x-apifox-orders: - copy_link - pay_expire_at - payment_no - qr_link x-apifox-ignore-properties: [] x-apifox-folder: '' DtoClientRechargePayConfig: properties: app_id: description: 应用ID type: string nonce_str: description: 随机字符串 type: string package: description: 预支付参数 type: string pay_sign: description: 支付签名 type: string sign_type: description: 签名类型 type: string timestamp: description: 时间戳 type: string type: object x-apifox-orders: - app_id - nonce_str - package - pay_sign - sign_type - timestamp x-apifox-ignore-properties: [] x-apifox-folder: '' ErrorResponse: properties: code: description: 错误码 type: integer examples: - 1001 data: description: 错误详情(可选) type: object x-apifox-orders: [] properties: {} x-apifox-ignore-properties: [] msg: description: 错误消息 type: string examples: - 参数验证失败 timestamp: description: 时间戳 format: date-time type: string required: - code - msg - timestamp type: object x-apifox-orders: - code - data - msg - timestamp x-apifox-ignore-properties: [] x-apifox-folder: '' securitySchemes: BearerAuth: bearerFormat: JWT scheme: bearer type: jwt AgentOpenAPIAccount: description: 代理账号标识,填写代理登录平台使用的用户名或手机号,例如 agent001。 in: header name: X-Agent-Account type: apikey AgentOpenAPINonce: description: 调用方每次请求自行生成的随机串,不需要平台提前分配;同一账号在 5 分钟内不可重复。 in: header name: X-Agent-Nonce type: apikey AgentOpenAPIPassword: description: 代理账号当前登录密码,同时作为 HMAC-SHA256 签名密钥;密码变更后必须使用新密码签名。 in: header name: X-Agent-Password type: apikey AgentOpenAPISign: description: 调用方按签名规则实时计算的 HMAC-SHA256 小写十六进制签名,不是固定值。 in: header name: X-Agent-Sign type: apikey AgentOpenAPITimestamp: description: 调用方生成的请求发起时间,支持 Unix 秒、Unix 毫秒或 RFC3339 时间,必须与签名原文 timestamp 行一致。 in: header name: X-Agent-Timestamp type: apikey Combination: group: - id: 1262265 - id: 1262266 - id: 1262267 - id: 1262268 - id: 1262269 type: combinationservers: - url: https://cmp-api.boss160.cn description: 测试环境security: []```