Stripe · sdk · fg-0149

metadata.get() raises AttributeError after upgrading stripe-python to v15

AttributeError when calling .get(), .keys() or .values() on a Stripe object

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

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")

Affects: stripe-python 15.0.0 (2026-03-25) and later

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp