- Symptom
- AttributeError when calling .get(), .keys() or .values() on a Stripe objectdict(stripe_object) returns an empty dictUnit tests that build events as plain dicts pass while production webhooks return 500
- Cause
- Since v15 StripeObject no longer inherits from dict. Attribute access, bracket access and in still work, but dict methods are gone.
- Fix
- Use getattr with a default, or call to_dict() first. Build test events with StripeObject.construct_from so tests match production.
- Apply
plan = getattr(session.metadata, "plan", None) # or plan = session.metadata.to_dict().get("plan")- Affected
- stripe-python 15.0.0 (2026-03-25) and later
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders