Stripe · sdk · fg-0156

subscription.items is a dict method, not the line items, in stripe-python before v15

TypeError: 'builtin_function_or_method' object is not iterable

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

Cause

Before v15 StripeObject subclassed dict, so the attribute name items resolved to dict.items and shadowed the API field.

Fix

Use bracket access for the field. On v15 and later sub.items returns the line items and key iteration moves to to_dict().

Apply

for item in subscription["items"]["data"]:
    print(item["price"]["id"])

Affects: stripe-python before 15.0.0; behavior changes in 15.0.0

Sources

Have your agent know this before it fails

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