Skip to content

Profit Sharing ​

Description of Profit Sharing Feature ​

The profit sharing feature transfers part of a payment order's amount to other recipient merchants. There are two kinds of profit sharing:

  • Order profit sharing: shares a specific payment order (with relationTxnId).
  • Global profit sharing: without relationTxnId, automatically shares every payment order cleared from then on according to the configuration.

A profit sharing request is not executed immediately. It is executed in the daily settlement run, and the result is sent through the callback. You can also get it from Query Current Profit Sharing Execution Result.

Profit Sharing Rules ​

  1. Currency: The sharing currency must equal the settlement currency of the payment order. Cross-currency profit sharing is not supported. For global profit sharing, the currency must be a settlement currency of the source merchant.
  2. Recipient: The recipient merchant (targetMerCode) must be an active merchant with a settlement account in the sharing currency. The source merchant and the recipient cannot be the same.
  3. Channel: Only payment orders of self-collected channels support profit sharing. Order profit sharing on other channels is rejected, and global profit sharing skips those orders. Contact BD to confirm which channels are supported.
  4. Global profit sharing: Only one active global profit sharing is allowed for the same source merchant, recipient and currency. It applies only to payment orders cleared in the daily run while the configuration is active, and is not applied to orders that were already cleared.
  5. No stacking: A payment order can use either global profit sharing or order profit sharing, not both. An order that has been shared by a global configuration cannot be shared again by an order profit sharing request; global profit sharing skips orders that have a pending order profit sharing request.
  6. Amount: Profit sharing can be executed multiple times for a payment order, but the cumulative sharing amount cannot exceed the available amount of the payment order (net settlement amount minus refunded and already shared amounts). Sharing amounts are rounded to the currency precision, and a sharing amount below 0.01 fails.
  7. Execution time: Profit sharing is executed every day starting at 15:00 UTC (23:00 Beijing time). Order profit sharing is executed only after the payment order has been cleared and stays "Pending" until then. After a successful execution the status changes to "Success"; on failure it changes to "Failed".
  8. Cancel: Pending order profit sharing and active global profit sharing can be canceled. Cancel is not allowed between 15:00 and 18:00 UTC (23:00 to 02:00 Beijing time) while profit sharing is being executed; use a reversal after the execution finishes. Successful profit sharing cannot be canceled, only reversed.
  9. Reversal: You can only reverse successful profit sharing initiated by yourself; pending profit sharing cannot be reversed. A reversal can be full or partial, and partial reversals can be done multiple times, but the cumulative reversed amount cannot exceed the amount received from the original profit sharing.
  10. Fees: Profit sharing and reversal are charged at the initiator's profit sharing rate and reversal rate, rounded to the currency precision. If the original profit sharing rate is configured to return fees, a reversal returns the original fee in proportion to the reversed amount. Profit sharing fails if no profit sharing rate is configured; contact BD to enable it.
  11. As profit sharing incurs fees, the cumulative total of profit sharing or reversal cannot exceed the amount of the original payment order or profit sharing after deducting fees. You might consider setting the fee to be deducted from the source account.
  12. Permission: Merchants can only initiate profit sharing for their own payment orders. Platform-type merchants can initiate profit sharing for the payment orders of their associated merchants (specify the merchant with sourceMerCode); see Query Delegated Merchants.
  13. Limits: A payment order can be shared at most 50 times, and each profit sharing can be reversed at most 10 times.

Explanation of the Actual Effect of Profit Sharing ​

Prerequisites ​

  1. Payment order amount: 100 USD
  2. Platform fee collected: 2 USD
  3. Actual settlement to Merchant A: 98 USD
  4. Merchant A initiates profit sharing of 10% to Merchant B (the base amount is the net settlement amount of the payment order, 98 USD).
  5. Payment processing fee rate: 2%
  6. Profit sharing fee rate: 2%
  7. Fees are rounded to cents: 9.80 × 2% = 0.196, recorded as 0.20.

Scenario 1: Handling fee deducted from the transaction ​

AccountProfit Sharing AmountHandling FeeAmount Received
Merchant A-9.800.00-9.80
Merchant B9.800.209.60

Scenario 2: Handling fee deducted from the source account ​

AccountProfit Sharing AmountHandling FeeAmount Received
Merchant A-9.800.20-10.00
Merchant B9.800.009.80

Explanation of the Actual Effect of Reversing Profit Sharing ​

Prerequisites ​

  1. Payment order amount: 100 USD
  2. Platform fee collected: 2 USD
  3. Actual settlement to Merchant A: 98 USD
  4. Merchant A initiates profit sharing of 10% to Merchant B with a fee of 2%.
  5. Merchant A initiates a full reversal (without splitMethod/splitValue). The reversed amount is the amount received from the original profit sharing (Note: The original profit sharing might not be reversed in full because of the deducted fees).
  6. Payment processing fee rate: 2%
  7. Profit sharing fee rate: 2%
  8. Reversal fee rate: 2%; the original profit sharing rate does not return fees.
  9. feeFrom of a reversal is set in the reversal request. In both scenarios below, the reversal uses the same feeFrom as the original profit sharing.

Scenario 1: Handling fee deducted from the transaction ​

AccountProfit Sharing AmountHandling FeeAmount Received
Merchant A-9.800.00-9.80
Merchant B9.800.209.60
Merchant A9.600.199.41
Merchant B-9.600.00-9.60

Scenario 2: Handling fee deducted from the source account ​

AccountProfit Sharing AmountHandling FeeAmount Received
Merchant A-9.800.20-10.00
Merchant B9.800.009.80
Merchant A9.800.009.80
Merchant B-9.800.20-10.00

Explanation of Fixed Amount Profit Sharing ​

  1. For common currencies such as JPY, KRW, VND, where the smallest unit is the base unit, the splitValue unit is in the base unit. For example, splitValue=1000 means a profit sharing of 1000 units.
  2. For common currencies such as USD, CNY, where the smallest unit is cents, the splitValue unit is in cents. For example, splitValue=1023 means a profit sharing of 10.23 USD.
  3. Amount fields in query results and callbacks also use the smallest currency unit.

Parameter Explanation ​

ParameterMandatoryTypeExplanation
referenceRequiredstring(240)The unique identifier of the profit sharing initiator, used to check uniqueness of profit sharing configurations. Only letters, digits and _ . : - are allowed.
sharingTypeRequiredint0: Profit Sharing, 2: Reversal of Profit Sharing
splitMethodConditionalint0: Percentage-based profit sharing, 1: Fixed amount profit sharing. Required for profit sharing; optional for a reversal (full reversal if omitted).
splitValueConditionalintWhen splitMethod=0, the profit sharing percentage with a precision of ten thousandths, from 1 to 9999. For example, splitValue=1023 means 10.23%
When splitMethod=1, the actual profit sharing amount (the smallest unit of the currency) Currency Rules.
Required for profit sharing; for a reversal, pass it together with splitMethod.
targetMerCodeConditionalstring(11)The recipient merchant. Required for profit sharing. Not needed for a reversal (same as the original profit sharing).
sourceMerCodeOptionalstring(11)The funding source merchant. If not provided, the current merchant is used. For order profit sharing it must be the merchant of the payment order. To share for another merchant, the current merchant must be its platform merchant.
currencyConditionalstring(3)Sharing currency, such as USD, CNY. Required for profit sharing and must equal the settlement currency of the payment order. Not needed for a reversal (same as the original profit sharing).
relationTxnIdConditionalstring(21)The ID of the payment order to share, which is nihaopay's transactionId. Omitting it for profit sharing creates a global profit sharing configuration; use with caution in production. Required for a reversal.
remarkOptionalstring(128)Remarks that appear in the order description when viewing the order. Only letters, digits, _ . : - and Chinese characters are allowed; spaces and punctuation are not.
feeFromOptionalint0: The handling fee is deducted from the transaction (paid by the recipient)
1: The handling fee is deducted from the source account
Default: 0
baseFromOptionalintBase amount for percentage-based calculation:
0: Net settlement amount of the original payment order
1: Amount of the original profit sharing (reversal only)
2: Order amount of the original payment order
Default: 0. For a partial percentage reversal you usually need 1.
originConfIdConditionalstring(21)Required for a reversal: the ID of the original profit sharing configuration to reverse.
notifyUrlOptionalstring(256)The callback URL for profit sharing results. Both success and failure are notified. Data format. Must be an http or https URL reachable from the public internet.

Profit Sharing Interface ​

postman setting download

Scenario: Initiate Global Percentage-based Profit Sharing

shell
curl --location 'https://api.nihaopay.com/v1.2/sharing/apply' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "sharingType": 0,
    "splitMethod": 0,
    "splitValue": 10,
    "reference": "20211111153109001472",
    "targetMerCode": "M001000001",
    "currency": "USD",
    "remark": "test_remark",
    "notifyUrl": "https://www.nihaopay.com/sharing/notify"
}'

Scenario: Initiate Percentage-based Profit Sharing for a Specific Order

shell
curl --location 'https://api.nihaopay.com/v1.2/sharing/apply' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20211111153109001472",
    "sharingType": 0,
    "splitMethod": 0,
    "splitValue": 1000,
    "targetMerCode": "M001000001",
    "reference": "20211111153109001472",
    "remark": "test_remark",
    "notifyUrl": "https://www.nihaopay.com/sharing/notify",
    "currency": "USD"
}'

Scenario: Initiate Fixed Amount Profit Sharing for a Specific Order

shell
curl --location 'https://api.nihaopay.com/v1.2/sharing/apply' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20211111153109001472",
    "sharingType": 0,
    "splitMethod": 1,
    "splitValue": 100,
    "targetMerCode": "M001000001",
    "reference": "20211111153109001472",
    "remark": "test_remark",
    "notifyUrl": "https://www.nihaopay.com/sharing/notify",
    "currency": "USD"
}'

Scenario: Partially Reverse Profit Sharing (50% of the original sharing amount)

shell
curl --location 'https://api.nihaopay.com/v1.2/sharing/apply' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20211111153109001472",
    "sharingType": 2,
    "splitMethod": 0,
    "splitValue": 5000,
    "baseFrom": 1,
    "reference": "20211111153109001473",
    "remark": "test_remark",
    "notifyUrl": "https://www.nihaopay.com/sharing/notify",
    "originConfId": "20211111153109001472"
}'

Scenario: Fully Reverse Profit Sharing

shell
curl --location 'https://api.nihaopay.com/v1.2/sharing/apply' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20211111153109001472",
    "sharingType": 2,
    "reference": "20211111153109001474",
    "remark": "test_remark",
    "notifyUrl": "https://www.nihaopay.com/sharing/notify",
    "originConfId": "20211111153109001472"
}'

Profit Sharing Initiation Success Response

json
{
  "confId": "20230804021118097285"
}

Profit Sharing Initiation Failure Response

json
{
  "code": 400,
  "label": "N/A",
  "message": "sharing config already exist"
}

Common failure reasons when applying:

messageExplanation
reference is invalid / remark is invalid / notifyUrl is invalidParameter format is invalid
relation transaction currency not matchSharing currency differs from the settlement currency of the payment order
source merchant has no settlement account in sharing currencyThe source merchant of a global configuration has no account in the currency
target merchant has no settlement account in sharing currencyThe recipient has no settlement account in the currency
targetMerCode not exist / targetMerCode is not activeThe recipient does not exist or is not active
channel provider not support sharingThe payment channel does not support profit sharing (not self-collected)
transaction already shared by global sharing configThe order was shared by a global configuration and cannot be shared again
no transaction sharing permissionNo permission to share for this merchant
sharing config already existDuplicate profit sharing configuration
reverse amount exceed available amountThe reversal amount exceeds the reversible amount

Query Current Profit Sharing Configuration ​

Returns profit sharing configurations initiated by the current merchant with status Pending (APPLY) or Success/Active (SUCCESS), up to 50 records. Canceled and failed configurations are not returned; get failure reasons from Query Current Profit Sharing Execution Result or the callback.

ParameterMandatoryTypeExplanation
relationTxnIdOptionalstring(21)Payment order ID
originConfIdOptionalstring(21)Original profit sharing configuration ID (reversals)
referenceOptionalstringInitiator's reference
sharingTypeOptionalint0: Profit Sharing, 2: Reversal
currencyOptionalstring(3)Sharing currency

Query all profit sharing configurations

shell
curl --location 'https://apitest.nihaopay.com/v1.2/sharing/query' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{}'

Query profit sharing configurations of a payment order

shell
curl --location 'https://apitest.nihaopay.com/v1.2/sharing/query' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20230804021118097285"
}'

Profit sharing configuration success response

json
{
  "sharingConfItems": [
    {
      "confId": "20230804021822097288",
      "reference": "9200",
      "originConfId": "",
      "relationTxnId": "20230804021118097285",
      "sourceMerCode": "M001000001",
      "targetMerCode": "M001000002",
      "sharingType": 0,
      "splitMethod": 0,
      "splitValue": 22,
      "sharingCurrency": "USD",
      "txnStatus": "SUCCESS",
      "failReason": "",
      "feeFrom": 0,
      "baseFrom": 0,
      "remark": "test",
      "notifyUrl": "https://www.nihaopay.com/sharing/notify"
    }
  ]
}

No matching configuration

json
{
  "sharingConfItems": []
}

Query Current Profit Sharing Execution Result ​

Queries the execution result of a profit sharing configuration on a payment order. Both relationTxnId and confId are required; a global configuration is executed on many orders, so pass the specific payment order ID. Results may be cached for up to 1 hour.

ParameterMandatoryTypeExplanation
relationTxnIdRequiredstring(21)Payment order ID
confIdRequiredstring(21)Profit sharing configuration ID

Request Example

shell
curl --location 'https://apitest.nihaopay.com/v1.2/sharing/detail' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "relationTxnId": "20230804021118097285",
    "confId": "20230804021822097288"
}'

Success Response Example (profit sharing succeeded)

json
{
  "txnType": "SHARE_PROFIT",
  "sharingStatus": "SUCCESS",
  "reference": "9200",
  "sharingType": 0,
  "relationTxnId": "20230804021118097285",
  "sharingConfId": "20230804021822097288",
  "sourceMerCode": "M001000001",
  "targetMerCode": "M001000002",
  "sharingCurrency": "USD",
  "txnCurrency": "USD",
  "exchangeRate": 1.0,
  "baseAmount": 13075,
  "sourceSharingTxnAmount": -29,
  "targetSharingTxnAmount": 29,
  "sourceServiceFee": 0,
  "targetServiceFee": 1,
  "feeRate": {
    "refundReturn": false,
    "rateAlgorithm": 0,
    "percentage": 2,
    "fixedAmount": 0,
    "minAmount": 0,
    "maxAmount": 0,
    "extraRefundFee": 0
  }
}

Success Response Example (profit sharing failed)

json
{
  "txnType": "SHARE_PROFIT",
  "sharingStatus": "FAIL",
  "reference": "9200",
  "sharingType": 0,
  "relationTxnId": "20230804021118097285",
  "sharingConfId": "20230804021822097288",
  "sourceMerCode": "M001000001",
  "targetMerCode": "M001000002",
  "sharingCurrency": "USD",
  "failReason": "sharing amount more than available amount"
}

Failure Response Example (not executed yet or not found)

json
{
  "code": 400,
  "label": "N/A",
  "message": "sharing history not exist"
}

Response fields:

FieldExplanation
txnTypeSHARE_PROFIT: profit sharing, SHARE_REVERSE: reversal
sharingStatusSUCCESS or FAIL
baseAmountBase amount for percentage-based calculation (smallest currency unit)
sourceSharingTxnAmount / targetSharingTxnAmountSharing amount of the source merchant / recipient (smallest currency unit, negative = debit)
sourceServiceFee / targetServiceFeeFee paid by the source merchant / recipient (smallest currency unit)
feeRateThe rate applied; percentage is in %
originSharingConfIdReversal only: the original profit sharing configuration ID
failReasonFailure only: see common failure reasons in Profit Sharing Callback

Cancel Profit Sharing ​

Pending order profit sharing and active global profit sharing can be canceled. Cancel is not allowed between 15:00 and 18:00 UTC (23:00 to 02:00 Beijing time) while profit sharing is being executed. Successful profit sharing can only be reversed.

Request

shell
curl --location 'https://apitest.nihaopay.com/v1.2/sharing/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "confId": "20230719002724096890"
}'

Success Response

json
{
  "confId": "20230719002724096890",
  "reason": "",
  "txnStatus": "SUCCESS"
}

Failure Response

json
{
  "confId": "20230719002724096890",
  "reason": "sharing config not exist",
  "txnStatus": "FAIL"
}

Common failure reasons (reason):

reasonExplanation
sharing config not existThe configuration does not exist
sharing config not belong to merchantThe configuration was not initiated by the current merchant
cancel is not allowed between 23:00 and 02:00 ...Profit sharing is being executed; reverse after it finishes
sharing operation was success,cannot cancelProfit sharing succeeded; it can only be reversed
operation failed, please check the transaction status.The configuration status has changed (e.g. already canceled or failed)

Query Delegated Merchants ​

Platform-type merchants query the associated merchants on whose behalf they can initiate profit sharing.

Request

shell
curl --location 'https://apitest.nihaopay.com/v1.2/sharing/merchants' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{}'

Response

json
{
  "merchants": [
    { "merCode": "M001000001" },
    { "merCode": "M001000002" }
  ]
}

Profit Sharing Callback ​

After each profit sharing is executed (success or failure), a JSON POST is sent to notifyUrl:

  1. The notification is sent once and is not retried. The request times out after 10 seconds and redirects are not followed.
  2. An HTTP 2xx response is treated as a successful notification.
  3. notifyUrl must be reachable from the public internet; private network addresses are not notified.
  4. The callback is not signed. After receiving it, confirm the result with Query Current Profit Sharing Execution Result.
  5. Amount fields are in the smallest unit of the settlement currency; rate.percentage is in %.
  6. For a reversal, txnType is SHARE_REVERSE, sourceMerCode is the recipient of the original profit sharing (the party being debited), targetMerCode is the source merchant of the original profit sharing, and originSharingConfId, originSharingType and originRate are also returned.

Profit Sharing Success Callback

json
{
  "sharingStatus": "SUCCESS",
  "txnType": "SHARE_PROFIT",
  "sharingType": 0,
  "reference": "TEST_20230803211516007112",
  "sharingConfId": "20230803211516007112",
  "relationTxnId": "20230803211516007111",
  "sourceMerCode": "M001100001",
  "targetMerCode": "M086100129",
  "txnCurrency": "USD",
  "stlCurrency": "USD",
  "sharingCurrency": "USD",
  "exchangeRate": 1.0,
  "baseAmount": 2496,
  "sourceSharingTxnAmount": -499,
  "targetSharingTxnAmount": 499,
  "sourceServiceFee": 0,
  "targetServiceFee": 10,
  "rate": {
    "minAmount": 0,
    "percentage": 2,
    "txnCurrency": "USD",
    "refundReturn": 0,
    "fixedAmount": 0,
    "maxAmount": 0
  }
}

Profit Sharing Failure Callback

json
{
  "sharingStatus": "FAIL",
  "txnType": "SHARE_PROFIT",
  "sharingType": 0,
  "reference": "TEST_20230803211516007112",
  "sharingConfId": "20230803211516007112",
  "relationTxnId": "20230803211516007111",
  "sourceMerCode": "M001100001",
  "targetMerCode": "M086100129",
  "txnCurrency": "USD",
  "stlCurrency": "USD",
  "sharingCurrency": "USD",
  "failReason": "sharing amount more than available amount"
}

Common failure reasons during execution (failReason):

failReasonExplanation
rate not foundNo profit sharing rate is configured for the initiator; contact BD
sharing amount more than available amountThe sharing amount exceeds the remaining shareable amount
sharing amount less than minimum amountThe sharing amount is below 0.01
sharing currency not match settlement currencySharing currency differs from the order's settlement currency
transaction already shared by global sharing configThe order was already shared by a global configuration
target merchant is not active / target merchant not existThe recipient is not active or does not exist
target merchant has no settlement account in sharing currencyThe recipient has no settlement account in the currency
sharing reverse amount more than origin sharing amountThe reversal amount exceeds the remaining reversible amount

Last Updated - 01/16/2025