Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayoutItem amount is a string not an integer #47

Open
airblade opened this issue Mar 8, 2019 · 3 comments
Open

PayoutItem amount is a string not an integer #47

airblade opened this issue Mar 8, 2019 · 3 comments

Comments

@airblade
Copy link

airblade commented Mar 8, 2019

I was surprised to find that a PayoutItem instance's amount is a string. I expected it to be an integer, or possibly a float, like a Payment instance's amount or a Payout instance's amount.

There's no difference in the API documentation for the various resources' amounts to indicate that the type can differ.

Is this intentional?

@Greyschale
Copy link

We store amounts as decimals, rather than floats (to prevent floating point errors and other rounding issues), but it seems like the reason for this is more to allow for the fact that decimals aren't always represented consistently across different systems (e.g. some require a precision to be specified). The string value allows for having the decimal value represented as we store it without having to specify precision or have any other issues with the representation.

Could you please link to the documentation example where the type is not referred to correctly? We should have consistent types for all our amounts, but if there's anything missing, we'll make sure to get it updated.

@airblade
Copy link
Author

airblade commented Oct 1, 2019

Sorry for the slow response!

None of the amount docs mentions the type.

I assumed they were all of the same type but evidently not.

In fact the API docs don't mention any types anywhere. It would be great to have the type included in the docs.

@matthieuprat
Copy link
Contributor

Thank you for getting back to us!

I assumed they were all of the same type but evidently not.

Payout items are the exception because we return those amounts in fractional currency to one decimal place. (E.g. if the amount of the payout item is £12.345, we'll serialize it as "1234.5".)

We'll make that clearer in the docs.

In fact the API docs don't mention any types anywhere. It would be great to have the type included in the docs.

Agreed, this would be nice to have. Currently, types can be inferred from the examples but this is suboptimal.

Including types in the API docs is not something we're actively looking into but if this becomes a common request, we will reevaluate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants