1
📥
Ambil laporan yuranAPI platform komisen, subsidi, caj
2
🧮
Kira peratusanKomisen vs harga jualan setiap order
3
🔍
Analisis trendBandingkan yuran bulan ke bulan
4
📊
Laporan & cadanganPeluang penjimatan + notifikasi
import requests, json, pandas as pd
API_FEES = "https://api.shopee.com/v2/finance/fees"
def fetch_fee_report(month):
resp = requests.get(API_FEES, params={"month": month})
return resp.json().get("fees", [])
def analyze_fees(fees):
df = pd.DataFrame(fees)
df["pct"] = df["commission"] / df["order_amount"] * 100
avg_fee = df["pct"].mean()
high_fees = df[df["pct"] > avg_fee * 1.2]
return {
"avg_commission": round(avg_fee, 2),
"total_fees": round(df["commission"].sum(), 2),
"high_fee_orders": len(high_fees),
"savings_potential": round(high_fees["commission"].sum() * 0.15, 2)
}
report = analyze_fees(fetch_fee_report("2026-06"))
print(json.dumps(report))