Docs
Docs
  • 简体中文
  • English
Docs
  • 简体中文
  • English
  • Docs

    • Common Conventions
    • Collection / Payin
    • Payout / Remittance
    • Account Balance
    • Transaction Query
    • Async Notification (Collection / Payout)
    • Signature
    • Account (Acct)
    • Special Instructions

Special Instructions

Precision Length

The system internally maintains 4 decimal places. For external processing and display, it becomes 2 decimal places.

For example, internal 123.1234 is processed and displayed externally as 123.12. The processing algorithm is described below.

Precision Algorithm

The "Banker's Rounding" algorithm is adopted, also known as "Round Half to Even". Examples are as follows:

Regular rounding

  • 1.234 → Keep two decimal places = 1.23 (because the third digit is 4, <5, round down)
  • 1.236 → Keep two decimal places = 1.24 (because the third digit is 6, >5, round up)

"Round Half to Even" cases (key) When the digit to be rounded is exactly 5, and there are no non-zero digits after it:

  • 1.245 → Keep two decimal places = 1.24 (round down, because 24 is even)
  • 1.255 → Keep two decimal places = 1.26 (round up, because 25 is odd, round to even 26)

Other cases

  • 1.2457 → Keep two decimal places = 1.25 (although it's 5, there's a 7 after it, >0, so round up directly)
  • -1.245 → Keep two decimal places = -1.24 (same rounding to even rule applies)
  • -1.255 → Keep two decimal places = -1.26 (odd becomes even, round to -1.26)

Data Calculation and "Error" Explanation

This system adopts independent proportional calculation for each content of every order.

Assumed rates:

  • Channel cost 0.013 -->1.3%
  • First-level agent 0.017 -->1.7%
  • Second-level agent 0.019 -->1.8%
  • Merchant rate 0.021 -->2.1%

Example 1:

Assume an order amount is 132.57   Then =>

  • Channel cost -> 132.57 *0.013 = 1.72341 recorded as 1.72 (triggered rule -> round down)
  • Merchant cost -> 132.57 *0.021 = 2.78397 recorded as 2.78 (triggered rule -> round down)
  • Second-level agent -> 132.57 *(0.021-0.018) = 0.39771 recorded as 0.40 (triggered rule -> round up)
  • First-level agent -> 132.57 *(0.018-0.017) = 0.13257 recorded as 0.13 (triggered rule -> round down)
  • Company profit -> 132.57 *(0.017-0.013) = 0.53028 recorded as 0.53 (triggered rule -> round down)

Total result verification:

Company profit -> 2.78-0.40-0.13-1.72=0.53.

Both methods yield consistent results

Example 2:

Assume an order amount is 345.00

  • Channel cost -> 345.00 *0.013 = 4.485 recorded as 4.49 (triggered rule -> round up)
  • Merchant cost -> 345.00 *0.021 = 7.245 recorded as 7.24 (triggered rule -> round half to even)
  • Second-level agent -> 345.00 *(0.021-0.018) = 1.035 recorded as 1.04 (triggered rule -> round down)
  • First-level agent -> 345.00 *(0.018-0.017) = 0.345 recorded as 0.34 (triggered rule -> round half to even)
  • Company profit -> 345.00 *(0.017-0.013) = 1.38 recorded as 1.38

Total result verification:

Company profit -> 7.24-1.04-0.34-4.49 = 1.37 with a 0.01 error compared to rate difference multiplied by total amount

In the books, the company "earned extra" 0.01. From another perspective, due to different calculation formulas, it may result in "the company's account being short by one cent"

Example 3:

Assume an order amount is 125

  • Channel cost -> 125.00 *0.013 = 1.625 recorded as 1.62 (triggered rule -> round half to even)
  • Merchant cost -> 125.00 *0.021 = 2.625 recorded as 2.62 (triggered rule -> round half to even)
  • Second-level agent -> 125.00 *(0.021-0.018) = 0.375 recorded as 0.38 (triggered rule -> round up)
  • First-level agent -> 125.00 *(0.018-0.017) = 0.125 recorded as 0.12 (triggered rule -> round half to even)
  • Company profit -> 125.00 *(0.017-0.013) = 0.5 recorded as 0.5

Total result verification:

Company profit -> 2.62-1.62-0.38-0.12=0.5 Both methods match.

However, if the upstream channel does not adopt the "round half to even" rule, but uses 3-digit rounding, it may be recorded as 125.00 *0.013 = 1.53

Company profit -> 2.62-1.63-0.38-0.12=0.49. This ultimately results in "the company's account being short by one cent"

Prev
Account (Acct)