⚡ Solution Summary
- Nested APIResource values are skipped during serialization.
- Workaround: Use ID references instead of objects.
- No fix planned due to deprecated functionality.
### Describe the bug
When serializing any stripe.StripeObject, nested stripe.APIResource values are silently skipped due to a continue branch in serialize()... This results in incomplete payloads sent to the Stripe API with no errors or warnings, causing data integrity issues and production failures... This happens inside stripe/_stripe_object.py (elif isinstance(v, stripe.APIResource): continue).
### To Reproduce
1- Create a stripe.Customer() and a nested stripe.PaymentMethod() with an id.
2- Assign the nested resource to the customer and call serialize().
3- Observe the nested field is missing from the serialized output...
### Expected behavior
- Nested APIResource values should not be dropped.
- The bare minimum here is to serialize them as ID references or just an object reference when an ID is not available...
### Code snippets
```Python
# stripe/_stripe_object.py
elif isinstance(v, stripe.APIResource):
continue # Silently drops nested APIResource objects
```
### OS
all
### Language version
python 3.13.7
### Library version
latest
### API version
2025-08-27.basil
### Additional context
_No response_
Discussion & Fixes