You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
toJson fails to create exactly the same json as the Stripe HTTP API #1845
As a result, when the InvoiceLineItem is serialized using toJson, it returns a completely different format than the Stripe API Http Server. They should be the same.
To Reproduce
Create an invoice and 1 invoice item.
Serialize that invoice using toJson.
View the serialize invoice item, and see that it's serialized as a json number rather than a string.
Expected behavior
Serializing an InvoiceLineItem using toJson is suppose to replicate the Stripe API HTTP server 100% exactly, and it's not doing that.
I'm using stripe sdk models to build mocks and stubs.
I observe the same issue with unit_amount_decimal and other similar fields. Moreover, someBigDecimal values want to be treated as numbers (e.g., percent_off in coupon details). This dichotomy means that I cannot simply create a type adapter to serialize all BigDecimal values as strings.
Activity
xavdid-stripe commentedon Aug 7, 2024
Thanks for filing! We've copied to our internal bug tracker and will address it when we have a chance.
decoursin commentedon Aug 8, 2024
Great, thank you
parfentjev commentedon Aug 26, 2025
I'm using stripe sdk models to build mocks and stubs.
I observe the same issue with
unit_amount_decimaland other similar fields. Moreover, someBigDecimalvalues want to be treated as numbers (e.g.,percent_offin coupon details). This dichotomy means that I cannot simply create a type adapter to serialize allBigDecimalvalues as strings.It's a major blocker for autotests.
Maybe there is some workaround I'm not aware of?