- Symptom
- TypeError: Object of type Decimal is not JSON serializableprice.unit_amount_decimal == '9.99' is now FalseType checker rejects a str passed as unit_amount_decimal
- Cause
- v15 maps every decimal formatted field, in responses and in request params, to Python Decimal instead of str.
- Fix
- Serialize with to_dict(for_json=True), compare against Decimal values, and pass Decimal when setting these fields.
- Apply
from decimal import Decimal payload = json.dumps(price.to_dict(for_json=True)) if price.unit_amount_decimal == Decimal("9.99"): ...- Affected
- stripe-python 15.0.0 and later
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders