If you build tools for Filipino sellers, sooner or later you hit a boring but sneaky problem. Money math.
Supplier rates come in one currency, often with four or five decimal places. Your customers want clean peso prices. And somewhere between the two, rounding errors quietly eat your margin.
Here's how I'd handle peso pricing in a small reseller or SMM tool.
Rule 1: never use floats for money
>>> 0.1 + 0.2 0.30000000000000004 Fine for physics. Terrible for invoices. Use Decimal in Python (or integer centavos everywhere).
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING def to_peso(value) -> Decimal: return Decimal(str(value)).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP) Rule 2: prices are per 1,000, orders aren't
Most social media service APIs quote a rate per 1,000 units. Customers order 250, 1,500 or 3,333. So the charge is:
def order_cost(rate_per_1000: Decimal, quantity: int) -> Decimal: raw = rate_per_1000 * Decimal(quantity) / Decimal(1000) # round UP to the centavo so you never undercharge return raw.quantize(Decimal("0.01"), rounding=ROUND_CEILING) Rounding up on cost protects you. Rounding half-up on the displayed price keeps it friendly.
Rule 3: show "nice" prices, store exact ones
Filipino buyers respond better to ₱49 than ₱48.73. But your ledger should keep the exact value.
def display_price(cost: Decimal, margin: Decimal) -> Decimal: price = cost * (Decimal(1) + margin) # round to the nearest peso for display return price.quantize(Decimal("1"), rounding=ROUND_HALF_UP) Store cost, margin and display_price separately. When a customer disputes a charge, you'll be glad you did.
Rule 4: minimum orders need a floor price
A 100-unit order at a tiny per-1,000 rate can round to ₱0.00. Set a floor:
MIN_CHARGE = Decimal("1.00") charge = max(order_cost(rate, qty), MIN_CHARGE) Rule 5: log the rate you used
Rates change. Log the exact rate at order time alongside the order ID so refunds and partial deliveries can be calculated against the right number.
Where this applies
Any tool that resells API-priced services in pesos. For a concrete example, BoostingPH is a Philippine social media service panel that exposes a standard order/status API at https://www.boostingph.com/api with peso pricing. Their write-up on how boosting sites in the Philippines price their services is useful context for why clean peso numbers matter to buyers.
Small rules. Fewer angry tickets. Cleaner books.
MD Fozla Rabbi, SEO Specialist