Skip to content

建立 2026-09-14 更新 2026-09-14

金額與幣別

Stripe API 的 amount / unit_amount 使用最小貨幣單位的整數,不是 199.00 這種小數。算錯會少收 100 倍或 API 直接報錯。

最小單位

幣別 零小數? unit_amount=1000 代表
USD、EUR 否,1 元 = 100 分 $10.00
TWD、JPY、KRW 是,沒有「分」 NT$1000 / ¥1000

零小數幣別清單新台幣 TWD 是零小數

# 收 NT$199
stripe.checkout.Session.create(
    mode="payment",
    line_items=[{
        "price_data": {
            "currency": "twd",
            "product_data": {"name": "電子書"},
            "unit_amount": 199,
        },
        "quantity": 1,
    }],
    success_url="https://example.com/success",
    cancel_url="https://example.com/cancel",
)

若寫成 unit_amount=19900,顧客會看到 NT$19,900。

USD 則相反:

"currency": "usd",
"unit_amount": 1999,  # $19.99

金額必須在伺服器計算

def calculate_order_amount(cart):
    prices = {"course": 1990, "ebook": 350}  # TWD
    return sum(prices[item] * qty for item, qty in cart.items())

不要做:

# 危險:相信瀏覽器送來的金額
amount = data["amount"]

購物車內容可以從 session 或登入使用者讀取,價格以你的資料庫或 Stripe Price 為準。

支援的幣別

Stripe 支援多種幣別,包含 TWD。能否結算進你的銀行,還取決於帳號國家與銀行設定。台灣相關限制見 台灣注意事項