# Create or reverse profit share

> Share the proceeds of a completed payment, or reverse a previously submitted profit share.

```yaml
openapi: 3.1.0
info:
  title: Create or reverse profit share
  version: 1.0.0
  description: Share the proceeds of a completed payment, or reverse a previously
    submitted profit share.
paths:
  /profit/share:
    post:
      summary: Create or reverse profit share
      description: Share the proceeds of a completed payment, or reverse a previously
        submitted profit share.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                currency:
                  type: string
                  description: Profit share or reversal currency, as a three-letter [ISO
                    4217](https://en.wikipedia.org/wiki/ISO_4217) currency code.
                gatewayReference:
                  type: string
                  description: Onerway payment transaction whose proceeds are shared. It is the
                    `transactionId` returned when the payment was created.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when `profitType` is `share`.
                  x-onerway-constraints:
                    - kind: rule
                      text: The payment must have been created with
                        `paymentMethodOptions.share.profitShare=true`; otherwise
                        it is not eligible for profit sharing.
                    - kind: rule
                      text: Do not submit it when `profitType` is `return`; the original order is
                        located through `profitParentReference` and
                        `profitGatewayReference` instead.
                merchantNo:
                  type: string
                  description: Merchant number submitting this profit share or reversal.
                  x-onerway-constraints:
                    - kind: rule
                      text: In the platform model, submit the sub-merchant that collected the payment,
                        matching the `merchantNo` used when the payment was
                        created.
                profitCompleted:
                  type: boolean
                  description: Whether this request completes profit sharing for the payment.
                    Submit `false` while further profit shares are still
                    expected.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when `profitType` is `share`.
                  x-onerway-constraints:
                    - kind: rule
                      text: Once submitted as `true`, further profit share requests for the same
                        payment are rejected.
                profitGatewayReference:
                  type: string
                  description: Onerway order number of the original profit share being reversed.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when `profitType` is `return`.
                profitParentReference:
                  type: string
                  description: Reference of the original profit share being reversed. For an
                    automatic profit share, this reference is generated by
                    Onerway.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when `profitType` is `return`.
                profitReference:
                  type: string
                  description: Merchant-side reference for this profit share or reversal.
                  x-onerway-constraints:
                    - kind: rule
                      text: Used as the idempotency key. Keep it globally unique across both profit
                        shares and reversals.
                profitType:
                  type: string
                  description: Operation to execute. It determines which reference fields are
                    required.
                  enum:
                    - share
                    - return
                  x-enum-descriptions:
                    share: Initiate a profit share for a completed payment.
                    return: Reverse a previously submitted profit share.
                receivers:
                  type: string
                  description: Profit share or reversal recipients. Submit one entry for each
                    detail.
                  contentMediaType: application/json
                  contentSchema:
                    type: array
                    items:
                      type: object
                      properties:
                        profitDetailReference:
                          type: string
                          description: Merchant-side reference for this detail. Keep it unique within the
                            same `profitReference`.
                        profitDetailParentReference:
                          type: string
                          description: Merchant-side reference of the original detail being reversed.
                          x-onerway-required: conditional
                          x-onerway-condition:
                            - Required when `profitType` is `return`.
                        profitDetailGatewayReference:
                          type: string
                          description: Onerway detail number of the original detail being reversed.
                          x-onerway-required: conditional
                          x-onerway-condition:
                            - Required when `profitType` is `return`.
                        type:
                          type: string
                          description: Fund purpose of this detail. It does not describe the recipient
                            account type.
                          enum:
                            - "1"
                            - "2"
                            - "3"
                            - "4"
                            - "5"
                            - "6"
                            - "7"
                            - "99"
                          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."
                        account:
                          type: string
                          description: Merchant number of the recipient. When reversing a profit share,
                            submit the recipient from the original detail.
                        amount:
                          type: string
                          description: Profit share or reversal amount for this detail.
                          x-onerway-constraints:
                            - kind: rule
                              text: Amount values use decimal strings. Avoid binary floating-point arithmetic
                                for money.
                        description:
                          type: string
                          description: Merchant-defined note for this detail, useful for reconciliation
                            and troubleshooting.
                      required:
                        - profitDetailReference
                        - type
                        - account
                        - amount
                  x-onerway-format: json_string
                sign:
                  type: string
                  description: Request signature string. See [Request
                    signing](/payments/get-started/request-signing) for how to
                    generate it.
                urlCallback:
                  type: string
                  description: URL for this API request’s profit share or reversal notification.
                    You can omit it when the original payment already has
                    `paymentMethodOptions.share.profitShareNotifyUrl`.
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when the original payment has no
                      `paymentMethodOptions.share.profitShareNotifyUrl`.
              required:
                - currency
                - merchantNo
                - profitReference
                - profitType
                - receivers
                - sign
            examples:
              create-profit-share:
                summary: Create a profit share
                value:
                  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
              reverse-profit-share:
                summary: Reverse a profit share
                value:
                  currency: USD
                  merchantNo: replace_with_merchant_no
                  profitGatewayReference: replace_with_original_profit_gateway_reference
                  profitParentReference: replace_with_original_profit_reference
                  profitReference: example_profit_reversal_reference
                  profitType: return
                  receivers: '[{"profitDetailReference":"example_profit_reversal_detail_reference","profitDetailParentReference":"replace_with_original_profit_detail_reference","profitDetailGatewayReference":"replace_with_original_profit_detail_gateway_reference","type":"1","account":"replace_with_receiver_merchant_no","amount":"80.00","description":"Reverse
                    seller settlement"}]'
                  sign: replace_with_calculated_signature
                  urlCallback: https://developers.onerway.com/example-profit-callback
      responses:
        "200":
          description: Profit share accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: "`20000` means the request was accepted. The final result should be
                      confirmed through the asynchronous notification or [Query
                      profit
                      share](/payments/api-reference/endpoints/query-profit-sha\
                      re). 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: Operation that was executed.
                        enum:
                          - share
                          - return
                        x-enum-descriptions:
                          share: Initiate a profit share for a completed payment.
                          return: Reverse a previously submitted profit share.
                      profitReference:
                        type: string
                        description: Merchant-side reference submitted in the request.
                      profitGatewayReference:
                        type: string
                        description: Onerway order number for this profit share or reversal. Store it
                          for later queries and reversals.
                      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.
                      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
                      sign:
                        type: string
                        description: Response signature string. Onerway does not require merchants to
                          verify signatures on synchronous responses.
                    description: Profit share or reversal result.
              examples:
                create-profit-share:
                  summary: Profit share accepted
                  value:
                    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
                reverse-profit-share:
                  summary: Profit share reversal accepted
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      profitType: return
                      profitReference: example_profit_reversal_reference
                      profitGatewayReference: replace_with_profit_reversal_gateway_reference
                      state: completed
                      currency: USD
                      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"}]'
                      sign: replace_with_sha256_signature
```
