# Query profit share

> Query the processing result of a profit share or reversal, including per-recipient details.

```yaml
openapi: 3.1.0
info:
  title: Query profit share
  version: 1.0.0
  description: Query the processing result of a profit share or reversal,
    including per-recipient details.
paths:
  /profit/query:
    post:
      summary: Query profit share
      description: Query the processing result of a profit share or reversal,
        including per-recipient details.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                gatewayReference:
                  type: string
                  description: For `share`, the `transactionId` of the original SALE payment. For
                    `return`, the Onerway order number of the profit share being
                    reversed. Use `relatedTxnId` to query a reversal by its
                    original payment.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Provide at least one of `profitReference`,
                      `gatewayReference`, `profitGatewayReference`,
                      `relatedTxnId`, or `relatedMerchantTxnId`.
                merchantNo:
                  type: string
                  description: Merchant number submitting this query.
                  x-onerway-constraints:
                    - kind: rule
                      text: Accepts a string or a JSON number. A string is recommended to preserve the
                        full identifier without numeric precision loss.
                    - kind: rule
                      text: For platform integrations, use the merchant number of the sub-merchant
                        that received the original payment. For a profit share
                        initiated through the API, this must match the
                        `merchantNo` in that request.
                profitGatewayReference:
                  type: string
                  description: Onerway order number returned when the profit share or reversal was
                    submitted.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Provide at least one of `profitReference`,
                      `gatewayReference`, `profitGatewayReference`,
                      `relatedTxnId`, or `relatedMerchantTxnId`.
                profitReference:
                  type: string
                  description: Reference of the profit share or reversal. For operations initiated
                    through the API, use the reference supplied by the merchant
                    in that request. For automatic profit shares and reversals,
                    Onerway generates the reference.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Provide at least one of `profitReference`,
                      `gatewayReference`, `profitGatewayReference`,
                      `relatedTxnId`, or `relatedMerchantTxnId`.
                relatedTxnId:
                  type: string
                  description: Transaction ID of the original payment, for both profit shares and
                    reversals.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Provide at least one of `profitReference`,
                      `gatewayReference`, `profitGatewayReference`,
                      `relatedTxnId`, or `relatedMerchantTxnId`.
                  x-onerway-constraints:
                    - kind: rule
                      text: Accepts a string or a JSON number. A string is recommended to preserve the
                        full identifier without numeric precision loss.
                    - kind: consistency
                      text: When multiple query identifiers are provided, they are applied together as
                        filters.
                relatedMerchantTxnId:
                  type: string
                  description: Merchant order number of the original payment, for both profit
                    shares and reversals.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Provide at least one of `profitReference`,
                      `gatewayReference`, `profitGatewayReference`,
                      `relatedTxnId`, or `relatedMerchantTxnId`.
                  x-onerway-constraints:
                    - kind: consistency
                      text: When multiple query identifiers are provided, they are applied together as
                        filters.
                profitType:
                  type: string
                  description: "Type of order to query: a profit share or a reversal."
                  enum:
                    - share
                    - return
                  x-enum-descriptions:
                    share: Query a profit share.
                    return: Query a profit share reversal.
                sign:
                  type: string
                  description: Request signature string. See [Request
                    signing](/payments/get-started/request-signing) for how to
                    generate it.
              required:
                - merchantNo
                - profitType
                - sign
            examples:
              query-profit-share:
                summary: Query a profit share
                value:
                  gatewayReference: replace_with_transaction_id
                  merchantNo: replace_with_merchant_no
                  profitGatewayReference: replace_with_profit_gateway_reference
                  profitReference: example_profit_share_reference
                  profitType: share
                  sign: replace_with_calculated_signature
              query-profit-share-reversal:
                summary: Query a profit share reversal
                value:
                  merchantNo: replace_with_merchant_no
                  profitGatewayReference: replace_with_profit_reversal_gateway_reference
                  profitReference: example_profit_reversal_reference
                  profitType: return
                  sign: replace_with_calculated_signature
              query-profit-share-partially-failed:
                summary: Query a profit share with a failed detail
                value:
                  gatewayReference: replace_with_transaction_id
                  merchantNo: replace_with_merchant_no
                  profitGatewayReference: replace_with_profit_gateway_reference
                  profitReference: example_partial_failure_profit_share_reference
                  profitType: share
                  sign: replace_with_calculated_signature
              query-reversal-by-original-order:
                summary: Query a reversal by original merchant order
                value:
                  merchantNo: replace_with_merchant_no
                  profitType: return
                  relatedMerchantTxnId: example_payment_order
                  sign: replace_with_calculated_signature
              query-by-original-transaction:
                summary: Query by original payment transaction
                value:
                  merchantNo: replace_with_merchant_no
                  profitType: share
                  relatedTxnId: "9007199254740993"
                  sign: replace_with_calculated_signature
      responses:
        "200":
          description: Profit share completed
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: "`20000` means the query was processed successfully. Other values
                      are error codes. See [Response
                      codes](/payments/api-reference/response-codes)."
                  respMsg:
                    type: string
                    description: Human-readable message for the response code.
                  data:
                    type: object
                    properties:
                      profitType:
                        type: string
                        description: Type of the queried order.
                        enum:
                          - share
                          - return
                        x-enum-descriptions:
                          share: Query a profit share.
                          return: Query a profit share reversal.
                      profitReference:
                        type: string
                        description: Reference of the queried profit share or reversal. For operations
                          initiated through the API, this is the reference
                          supplied by the merchant in that request. For
                          automatic profit shares and reversals, Onerway
                          generates the reference.
                      profitGatewayReference:
                        type: string
                        description: Onerway order number of the queried order.
                      state:
                        type: string
                        description: Overall processing state of the order. Do not treat `completed` as
                          every detail having succeeded; check
                          `receivers[].result` individually.
                        enum:
                          - processing
                          - completed
                        x-enum-descriptions:
                          processing: The profit share order is still being processed.
                          completed: The profit share order finished processing. Check each detail result
                            separately.
                      currency:
                        type: string
                        description: Settlement currency of the profit share or reversal.
                      relatedTxnId:
                        type:
                          - string
                          - "null"
                        description: Transaction ID of the original payment. A reversal still references
                          the original payment, not the profit share order.
                        x-onerway-value:
                          nullable: true
                      relatedMerchantTxnId:
                        type:
                          - string
                          - "null"
                        description: Merchant order number of the original payment.
                        x-onerway-value:
                          nullable: true
                      sign:
                        type: string
                        description: Response signature. Merchants do not need to verify this query
                          response signature.
                      receivers:
                        type: string
                        description: Per-recipient processing results.
                        contentMediaType: application/json
                        contentSchema:
                          type: array
                          items:
                            type: object
                            properties:
                              profitDetailReference:
                                type: string
                                description: Merchant-side reference submitted for this detail.
                              profitDetailGatewayReference:
                                type: string
                                description: Onerway detail number for this detail.
                              type:
                                type:
                                  - string
                                  - "null"
                                description: Fund purpose of this detail.
                                enum:
                                  - "1"
                                  - "2"
                                  - "3"
                                  - "4"
                                  - "5"
                                  - "6"
                                  - "7"
                                  - "99"
                                  - null
                                x-enum-descriptions:
                                  "1": "Merchant settlement: the order settlement amount allocated to the actual
                                    seller, sub-merchant, or service provider."
                                  "2": "Platform service fee: commission, technical service fees, and software
                                    service fees earned by the platform."
                                  "3": "Partner commission: commission paid to channel, agency, or distribution
                                    partners."
                                  "4": "Payment processing fee: acquiring fees, transaction processing fees, and
                                    payment channel costs."
                                  "5": "Tax: VAT, GST, or other tax amounts that must be collected separately."
                                  "6": "Logistics and fulfillment fee: logistics, delivery, warehousing, and
                                    fulfillment costs."
                                  "7": "Marketing subsidy: discounts, subsidies, campaign costs, or marketing
                                    spend borne by one party."
                                  "99": "Other: any other profit share purpose agreed between Onerway and the
                                    merchant."
                                x-onerway-value:
                                  nullable: true
                                  when:
                                    en: Returns `null` when the fund purpose is not recorded.
                                    zh: 未记录资金用途时返回 `null`。
                              amount:
                                type: string
                                description: Processed profit share or reversal amount.
                                x-onerway-constraints:
                                  - kind: rule
                                    text: Amount values use decimal strings. Avoid binary floating-point arithmetic
                                      for money.
                              result:
                                type: string
                                description: Processing result of this detail.
                                enum:
                                  - pending
                                  - success
                                  - failed
                                x-enum-descriptions:
                                  pending: The detail is still being processed.
                                  success: The detail was processed successfully.
                                  failed: The detail failed. Check `failReason`.
                              failReason:
                                type:
                                  - string
                                  - "null"
                                description: Failure reason for this detail.
                                x-onerway-constraints:
                                  - kind: rule
                                    text: Human-readable troubleshooting text with no fixed value set. Branch on
                                      `result` rather than matching this string.
                                x-onerway-value:
                                  nullable: true
                                  when:
                                    en: Returned only when `result` is `failed`; otherwise `null`.
                                    zh: 仅当 `result` 为 `failed` 时返回；其余情况为 `null`。
                              createdAt:
                                type: string
                                description: Detail creation time.
                                x-onerway-constraints:
                                  - kind: rule
                                    text: Formatted as `yyyy-MM-dd HH:mm:ss`. Do not parse it as a Unix timestamp.
                              finishedAt:
                                type:
                                  - string
                                  - "null"
                                description: Detail completion time.
                                x-onerway-constraints:
                                  - kind: rule
                                    text: Formatted as `yyyy-MM-dd HH:mm:ss`. Do not parse it as a Unix timestamp.
                                x-onerway-value:
                                  nullable: true
                                  when:
                                    en: Returns `null` while `result` is `pending`.
                                    zh: "`result` 为 `pending` 时返回 `null`。"
                        x-onerway-format: json_string
                    description: Profit share or reversal result.
              examples:
                query-profit-share:
                  summary: Profit share completed
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      profitType: share
                      profitReference: example_profit_share_reference
                      profitGatewayReference: replace_with_profit_gateway_reference
                      state: completed
                      currency: USD
                      relatedTxnId: "9007199254740993"
                      relatedMerchantTxnId: example_payment_order
                      sign: replace_with_response_signature
                      receivers: '[{"profitDetailReference":"example_profit_share_detail_reference","profitDetailGatewayReference":"replace_with_profit_detail_gateway_reference","type":"1","amount":"80.00","result":"success","failReason":null,"createdAt":"2026-06-22
                        10:00:00","finishedAt":"2026-06-22 10:00:08"}]'
                query-profit-share-reversal:
                  summary: Profit share reversal completed
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      profitType: return
                      profitReference: example_profit_reversal_reference
                      profitGatewayReference: replace_with_profit_reversal_gateway_reference
                      state: completed
                      currency: USD
                      relatedTxnId: "9007199254740993"
                      relatedMerchantTxnId: example_payment_order
                      sign: replace_with_response_signature
                      receivers: '[{"profitDetailReference":"example_profit_reversal_detail_reference","profitDetailGatewayReference":"replace_with_profit_reversal_detail_gateway_reference","type":"1","amount":"80.00","result":"success","failReason":null,"createdAt":"2026-06-22
                        11:00:00","finishedAt":"2026-06-22 11:00:08"}]'
                query-profit-share-partially-failed:
                  summary: Profit share completed with a failed detail
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      profitType: share
                      profitReference: example_partial_failure_profit_share_reference
                      profitGatewayReference: replace_with_profit_gateway_reference
                      state: completed
                      currency: USD
                      relatedTxnId: "9007199254740993"
                      relatedMerchantTxnId: example_payment_order
                      sign: replace_with_response_signature
                      receivers: '[{"profitDetailReference":"example_successful_profit_detail_reference","profitDetailGatewayReference":"replace_with_successful_profit_detail_gateway_reference","type":"1","amount":"80.00","result":"success","failReason":null,"createdAt":"2026-06-22
                        12:00:00","finishedAt":"2026-06-22
                        12:00:08"},{"profitDetailReference":"example_failed_profit_detail_reference","profitDetailGatewayReference":"replace_with_failed_profit_detail_gateway_reference","type":"2","amount":"20.00","result":"failed","failReason":"Receiver
                        account is not enabled for profit
                        sharing.","createdAt":"2026-06-22
                        12:00:00","finishedAt":"2026-06-22 12:00:09"}]'
```
