数币收单开放 API 文档Digital Acquire Open API

面向商户与对接方技术,说明通过开放平台网关调用数币收单相关 HTTP 接口的约定。网关负责解密、验签、鉴权及请求转发;环境域名、密钥与联调样例由运营或商务另行提供。 For merchants and integrators: conventions for calling digital-asset acquire APIs through the open platform gateway. The gateway handles decryption, signature verification, auth, and forwarding. Base URLs, keys, and UAT samples are provided by operations or business separately.

统一网关与安全Gateway & security

RSA 加密请求体、RSA-SHA256 签名(X-App-Id、时间戳、随机串与明文参与签串),HTTPS 传输;响应密文解密与可选响应头验签。 RSA-encrypted body, RSA-SHA256 sign string (X-App-Id, timestamp, nonce, plaintext) over HTTPS; decrypt response payload and optionally verify response headers.

幂等与流水号Idempotency

相同 X-App-IdX-Request-no 的重复请求可能被识别为同一笔并返回首次结果;时间戳建议在网关允许的窗口内。 Duplicate requests with the same X-App-Id and X-Request-no may be treated as one and return the first result. Keep timestamps within the gateway window.

标准化响应Standard response

网关外层 code / message / data(密文);解密后为统一业务结果对象(如 R),内含业务 codemsg 与载荷 data Outer envelope code / message / encrypted data. After decryption, a unified result object (e.g. R) with business code, msg, and payload data.

异步通知Webhooks

收单订单状态、退款结果通过商户配置的 HTTPS 地址 POST JSON 推送;须按约定返回成功标识以便平台重试策略生效。 Order and refund updates are POSTed as JSON to your HTTPS URLs. Return the agreed success marker so platform retries behave correctly.

💡 最佳实践💡 Best practices

⚠️ 注意事项⚠️ Notes

环境与访问方式Environment & access

项目Item 说明Description
测试环境网关Test (UAT) gateway http://open.saferoute.global:16000(文档中下记为 {BASE} 时,测试联调请替换为此地址)http://open.saferoute.global:16000 — use this as {BASE} for UAT.
生产环境网关Production gateway 运营人员通过邮件单独发送,请勿使用测试地址上线。The production base URL is sent by operations via email; do not use the UAT host in production.
请求方法HTTP method 统一 POSTAlways POST
路径格式Path pattern {BASE}/api/route + 接口相对路径(见下表){BASE}/api/route + relative path (see table below)
幂等Idempotency 相同 X-App-IdX-Request-no 可能返回首次结果Same X-App-Id + X-Request-no may return the first outcome

商户在开放平台完成开户后获得 X-App-Id、RSA 密钥材料、是否 IP 白名单等。路由与权限由平台后台配置。After onboarding you receive X-App-Id, RSA key material, optional IP allowlists, etc. Routes and permissions are configured in the platform console.

请求约定Request conventions

HTTP 头(必填)Required HTTP headers

头名称Header 说明Description
X-App-Id应用标识;与报文中 memberId(若上传)须一致App id; must match memberId in body when present
X-SignRSA-SHA256 签名,Base64RSA-SHA256 signature, Base64
X-Timestamp毫秒时间戳,与网关偏差建议 1 分钟内Millis timestamp; keep within ~1 minute of gateway time
X-Nonce随机串,防重放Random nonce, replay protection
X-Request-no请求流水号,建议全局唯一Request id; should be globally unique

Content-Type: application/json

请求体Request body

外层固定为密文包装:Outer envelope is always encrypted:

{ "data": "<RSA ciphertext Base64>" }

明文为各接口业务 JSON(UTF-8),使用平台下发的加密公钥加密。签名字符串:Plaintext is per-API business JSON (UTF-8), encrypted with the platform encryption public key. Sign string:

X-App-Id + ";" + X-Timestamp + ";" + X-Nonce + ";POST;" + plaintext JSON

使用商户签名私钥签名;网关用平台验签公钥校验。密钥命名以运营说明为准。Sign with the merchant signing private key; the gateway verifies with the platform public key. Key naming follows operations’ guide.

响应体Response body

{
  "code": "0000",
  "message": "Success",
  "data": "<RSA ciphertext Base64>"
}

使用商户解密私钥解密 data。内层常见字段:Decrypt data with the merchant private key. Inner fields often include:

字段Field 说明Description
code业务状态码;成功多为 "200"(与外层不同,以联调为准)Business code; success often "200" (differs from outer layer; confirm in UAT)
msg / message提示信息Message text
data业务载荷;下文「响应说明」均指该字段结构Payload; “Response” below means this inner data

响应头可能含 X-SignX-TimestampX-Nonce,验签规则以运营细则为准。Response may include X-Sign, X-Timestamp, X-Nonce; verify per operations’ rules.

收单类开放接口(7 个)Acquire APIs (7)

以下路径接在 {BASE}/api/route 之后。若环境配置了版本或前缀,以运营确认为准。Append these paths after {BASE}/api/route. Version or prefix overrides follow operations.

# 说明Summary 路径Path
1查询可充值链路、币种等信息Deposit chains & currencies/orderApi/getDepositInfo
2创建收单订单Create payment order/orderApi/createPaymentOrder
3收单订单分页列表Paged order list/orderApi/queryAcquireOrderList
4收单订单详情Order detail/orderApi/queryAcquireOrder
5创建退款Create refund/orderApi/createRefundOrder
6查询退款进度Query refund/orderApi/queryRefundOrder
7更新收单支付信息(换链/换币种等)Update pay info (chain/currency)/orderApi/updatePayInfo

示例(占位):Example (placeholder): POST {BASE}/api/route/orderApi/createPaymentOrder

测试环境完整示例:UAT full URL example: POST http://open.saferoute.global:16000/api/route/orderApi/createPaymentOrder

查询链路 / 币种 — getDepositInfoChains & tokens — getDepositInfo

POST …/orderApi/getDepositInfo

请求明文Request plaintext

字段Field 类型Type 必填Required 说明Description
memberIdString 视环境Env-dependent 是否必填以联调及运营说明为准Confirm required or not in UAT / with operations

响应 data(数组)Response data (array)

链路列表元素字段:Each chain item includes: chainName, regular, chainId, coinTokenModels.

coinTokenModels

字段Field 类型Type 说明Description
coinSymsbolString币种符号(字段名以实际 JSON 为准)Symbol (field name as in actual JSON)
showNameString展示名称Display name
tokenBaseNameString基础名称Base name
currencyIdString报价币种 IDQuote currency id
checkCountInteger链上确认数要求Required on-chain confirmations

创建收单订单 — createPaymentOrderCreate order — createPaymentOrder

POST …/orderApi/createPaymentOrder

请求明文Request plaintext

字段Field 类型Type 必填Req 说明Description
memberIdStringYesX-App-Id 一致Same as X-App-Id
memberOrderNoStringYes商户订单号,建议唯一Merchant order no.; should be unique
chainIdIntegerYes链路 IDChain id
descriptionStringYes订单描述Order description
currencyIdIntegerYes报价币种 IDQuote currency id
quoteAmountStringYes报价金额Quoted amount
memberNotifyUrlStringYes订单状态异步通知 HTTPS 地址HTTPS URL for async order status

响应 dataResponse data

字段Field 类型Type 说明Description
memberOrderNoString商户订单号Merchant order number
outTradeNoString平台收单订单号Platform acquire order id
chainIdInteger链路 IDChain id
descriptionString描述Description
userWalletAddressString收款地址(展示给用户)Deposit address (show to payer)
expiredTimeString过期时间(格式以联调为准)Expiry time (format per UAT)

收单订单列表 — queryAcquireOrderListOrder list — queryAcquireOrderList

POST …/orderApi/queryAcquireOrderList

商户范围由网关根据 X-App-Id 识别,请求体一般无需再传 memberIdMerchant scope comes from X-App-Id; you usually omit memberId in the body.

请求明文Request plaintext

字段Field 类型Type 必填Req 说明Description
paymentStatusIntegerNo支付状态筛选Filter by payment status
orderStartTimeStringNo开始时间Start time
orderEndTimeStringNo结束时间End time
currentLongYes当前页Current page
sizeLongYes每页条数Page size

响应 data(分页)Response data (page)

字段Field 类型Type 说明Description
totalLong总记录数Total rows
totalPageLong总页数Total pages
currentLong当前页Current page
sizeLong每页条数Page size
rowsArray订单摘要列表Order summary rows

rows 单项rows item

字段Field 说明Description
memberOrderNo商户订单号Merchant order number
outTradeNo平台收单订单号Platform acquire order id
chainId链路 IDChain id
paymentStatus0 已支付;1 待支付;2 确认中;3 部分支付;4 失败;5 已退款;6 退款中;7 待退款失败;8 入帐中;9 已关闭0 paid; 1 pending; 2 confirming; 3 partial; 4 failed; 5 refunded; 6 refunding; 7 refund pending fail; 8 crediting; 9 closed
fromAddress付款地址(若有)Payer address if present
orderStartTime订单创建时间Order created time
orderEndTime订单结束/过期时间Order end / expiry time

收单订单详情 — queryAcquireOrderOrder detail — queryAcquireOrder

POST …/orderApi/queryAcquireOrder

请求明文Request plaintext

字段Field 类型Type 必填Req
memberOrderNoStringYes

响应 data 字段Response data fields

字段Field 类型Type 说明Description
chainIdInteger链路 IDChain id
memberOrderNoString商户订单号Merchant order number
quoteAmountString订单报价金额Quoted order amount
quoteCurrencySymbolString报价币种符号(法币或数币,大写)Quote currency symbol (fiat or crypto, upper case)
orderEndTimeString订单有效期/过期时间Order validity / expiry
paymentTimeString支付时间(未支付可能为空)Paid time (empty if unpaid)
paymentStatusInteger含义同订单列表中的 paymentStatusSame semantics as list paymentStatus
fromAddressString付款地址(可能为空,以联调为准)Payer address (may be empty; confirm in UAT)
paymentResultObject支付结果明细,见下表Payment breakdown; see table below
refundInfoObject退款信息(无退款时子字段可能为空),见下表Refund info; subfields may be empty; see below

paymentResult

字段Field 类型Type 说明Description
paymentAmtString实付金额Paid amount
paymentFeeString收单手续费Acquire fee
paymentCcyString支付币种Payment currency
exchangeRateString汇率(若有)FX rate if applicable

refundInfo

字段Field 类型Type 说明Description
refundTimeString退款时间Refund time
refundHashString退款链上哈希On-chain refund tx hash
refundAmtString退款金额Refund amount
refundFeeString退款手续费Refund fee
refundCcyString退款币种Refund currency
transferAddressString退款收款地址Refund recipient address

创建退款 — createRefundOrderCreate refund — createRefundOrder

POST …/orderApi/createRefundOrder

请求明文Request plaintext

字段Field 类型Type 必填Req 说明Description
memberIdStringYesX-App-Id 一致Same as X-App-Id
memberOrderNoStringYes原收单商户订单号Original merchant order number
refundAmountStringYes退款金额Refund amount
refundCallbackUrlStringYes退款结果异步通知 HTTPSHTTPS URL for async refund result

响应 dataResponse data

字段Field 类型Type 说明Description
refundOrderNoString平台退款单号(查询与对账请保存)Platform refund id — store for queries & reconciliation
refundStatusInteger0 成功;1 退款中;4 失败;5 审核驳回(以联调为准)0 success; 1 processing; 4 failed; 5 rejected (confirm in UAT)
refundAmountNumber预计到账退款金额Expected refund amount credited
refundFeeNumber手续费Fee
refundSymbolString退款币种符号Refund currency symbol
refundRemarkString备注/说明Remark / note
toAddressString退款目标地址Destination address for refund

查询退款 — queryRefundOrderQuery refund — queryRefundOrder

POST …/orderApi/queryRefundOrder

请求明文Request plaintext

字段Field 类型Type 必填Req
memberIdStringYes
refundOrderNoStringYes

响应 data 字段Response data fields

字段Field 类型Type 说明Description
memberOrderNoString商户订单号Merchant order number
outTradeNoString平台收单订单号Platform acquire order id
refundOrderNoString退款单号Refund order number
refundStatusInteger退款状态,含义同创建退款接口Refund status; same as create-refund response
refundFailReasonString失败原因(失败/驳回时有值)Failure reason when failed or rejected
refundAmountString退款金额Refund amount
refundFeeString手续费Fee
refundTimeString退款发起时间Refund initiated time
refundCompleteTimeString退款完成时间Refund completed time
transferHashString退款交易哈希On-chain transfer / refund hash

更新收单支付信息 — updatePayInfoUpdate pay info — updatePayInfo

POST …/orderApi/updatePayInfo

请求明文Request plaintext

字段Field 类型Type 必填Req 说明Description
memberIdStringYesX-App-Id 一致Same as X-App-Id
chainIdIntegerYes新链路 IDNew chain id
currencyIdintYes新报价币种 IDNew quote currency id
memberOrderNoStringYes商户订单号Merchant order number

响应 dataResponse data

字段Field 类型Type 说明Description
userWalletAddressString更新后的收款子合约/钱包地址Updated deposit sub-wallet / contract address
saltHashString子合约校验用盐值哈希(与通知、链上校验配套,以联调为准)Salt hash for sub-contract checks (see UAT / notifications)

异步通知(商户服务端)Webhooks (merchant server)

收单订单状态 — memberNotifyUrlOrder status — memberNotifyUrl

订单状态变更后 POST JSON,常见字段包括:memberOrderNooutTradeNochainIddescriptionquoteCurrencySymbolquoteAmountuserWalletAddresssaltHashpaymentStatus、时间字段、支付金额/手续费/币种、remark,以及退款相关字段(有则返回)。On status change, platform POSTs JSON. Typical fields: memberOrderNo, outTradeNo, chainId, description, quoteCurrencySymbol, quoteAmount, userWalletAddress, saltHash, paymentStatus, timestamps, paid amount/fee/currency, remark, and refund fields when applicable.

回执: HTTP Body 建议返回 JSON,且 code 整型为 200 表示接收成功,否则平台可能重试。Ack: Respond with JSON whose integer code is 200 for success; otherwise retries may occur.

退款结果 — refundCallbackUrlRefund result — refundCallbackUrl

常见字段:refundOrderNomemberOrderNooutTradeNorefundAmountrefundSymbolamountFeetoAddressrefundStatusrefundRemarkrefundHash。成功回执约定同上。Typical fields: refundOrderNo, memberOrderNo, outTradeNo, refundAmount, refundSymbol, amountFee, toAddress, refundStatus, refundRemark, refundHash. Same ack rules as above.

安全与联调清单Security & UAT checklist

  • 密钥勿入仓库;生产与测试密钥分离。Never commit keys; separate prod and test secrets.
  • 仅调用本文档列出的开放路径。Call only documented open paths.
  • 时间戳、随机串、流水号与 HTTPS 通知按规范实现。Implement timestamps, nonce, request id, and HTTPS webhooks per spec.

商户侧检查清单Merchant checklist

  • 已获得 X-App-Id 与 RSA 密钥材料Received X-App-Id and RSA key material
  • 已实现请求加密、签名及响应解密、验签Request encrypt/sign and response decrypt/verify implemented
  • 已在测试环境验证 7 个接口All seven APIs verified in test
  • 已实现异步通知并按约定返回成功标识Webhooks implemented with correct success marker
  • 已确认幂等与时间戳窗口策略Idempotency and timestamp window agreed