๐Ÿ› Software ยท LARZ-401 · Session 5 of 8

Split Payouts

Record what the seller and the platform are each owed on every sale.

⏱ 11 min read📅 Updated 2026-07-25📊 Code examples throughout

Split the sale

@app.get("/bought/<id:int>")
def bought(req):
    lst = Listing.get(req.params["id"])
    fee = int(lst.price_cents * 0.15)          # 15% platform fee
    app.money.split([(lst.seller, lst.price_cents - fee),
                     ("platform", fee)], sku="listing:%d" % lst.id)
    return "Thanks!"

Each sale writes a ledger row per party. Guard it so a buyer refreshing the page doesn't double-record โ€” pass a unique ref and skip if it already exists.

Read the ledger

app.money.owed("seller:alice")     # cents currently owed
app.money.payouts("seller:alice")  # the rows
app.money.mark_paid(payout_id)     # settle one when you pay out

Takeaways

  • split() takes (party, amount) pairs โ€” dollars or integer cents.
  • owed() sums pending payouts for a party.
  • This is the money-native core extended to marketplaces.

More in this course

Course home → · Browse all courses →