Onerway
POST

发起分账或分账回退

该接口用于对已完成的支付发起分账,或对一笔已有分账发起回退,由 profitType 决定本次执行的操作。

请求

currency
分账或分账回退币种,使用 ISO 4217 三位字母货币代码。
示例:
gatewayReference
条件:profitType 为 share 时必填。
要分账的 Onerway 支付交易,取创建支付时返回的 transactionId。
示例:
约束
规则
创建支付时必须设置 paymentMethodOptions.share.profitShare=true,否则该笔支付不具备分账资格。
规则
profitType 为 return 时不要传入;回退通过 profitParentReference 与 profitGatewayReference 定位原分账单。
merchantNo
发起本次分账或分账回退的商户号。
示例:
约束
规则
平台模式下传收款的子商户号,与创建该笔支付时使用的 merchantNo 保持一致。
profitCompleted
条件:profitType 为 share 时必填。
本次请求是否已结束该笔支付的分账;后续还会继续分账时传 false。
示例:
约束
规则
一旦传入 true,该笔支付后续再发起分账会被拒绝。
profitGatewayReference
条件:profitType 为 return 时必填。
被回退的原分账单号,由 Onerway 在发起分账时返回。
示例:
profitParentReference
条件:profitType 为 return 时必填。
被回退的原分账请求号。自动分账的请求号由 Onerway 生成。
示例:
profitReference
本次分账或分账回退的商户侧请求号。
示例:
约束
规则
该字段作为幂等键使用;分账与分账回退的请求号需全局唯一。
profitType
要执行的操作类型;该值决定哪些关联单号字段必填。
示例:
可选值
share
对已完成的支付发起分账。
return
对一笔已有分账发起回退。
分账或分账回退的接收方列表;每条明细传入一个对象。
sign
请求签名字符串;生成方式详见请求签名。
urlCallback
条件:原支付未配置 paymentMethodOptions.share.profitShareNotifyUrl 时必填。
接收本次 API 分账或分账回退结果通知的地址。原支付已配置 paymentMethodOptions.share.profitShareNotifyUrl 时,无需再传本字段。
示例:

请求示例

curl -X POST 'https://sandbox-acq.onerway.com/profit/share' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "currency": "USD",
  "gatewayReference": "replace_with_transaction_id",
  "merchantNo": "replace_with_merchant_no",
  "profitCompleted": false,
  "profitReference": "example_profit_share_reference",
  "profitType": "share",
  "receivers": "[{\"profitDetailReference\":\"example_profit_share_detail_reference\",\"type\":\"1\",\"account\":\"replace_with_receiver_merchant_no\",\"amount\":\"80.00\",\"description\":\"Seller settlement\"}]",
  "sign": "replace_with_calculated_signature",
  "urlCallback": "https://developers.onerway.com/example-profit-callback"
}'

响应

respCode
响应码;20000 表示请求受理成功,最终结果以异步通知或查询分账结果为准;其余为错误码。完整码表见响应码。
respMsg
响应码对应的可读说明。
分账或分账回退结果。

响应示例

{
  "respCode": "20000",
  "respMsg": "Success",
  "data": {
    "profitType": "share",
    "profitReference": "example_profit_share_reference",
    "profitGatewayReference": "replace_with_profit_gateway_reference",
    "state": "processing",
    "currency": "USD",
    "receivers": "[{\"profitDetailReference\":\"example_profit_share_detail_reference\",\"profitDetailGatewayReference\":\"replace_with_profit_detail_gateway_reference\",\"type\":\"1\",\"amount\":\"80.00\",\"result\":\"pending\",\"failReason\":null,\"createdAt\":\"2026-06-22 10:00:00\",\"finishedAt\":null}]",
    "sign": "replace_with_sha256_signature"
  }
}
该接口暂未记录错误响应。