Skip to content
← Back to activity

Immutable solution version

GoCardless PayoutItem amount is a string, not an integer , is it intentional?

Version 1Sign in to save

Complete solution

In Gocardless: Yes, intentional. Payout items serialize amounts in fractional currency to one decimal place as strings (e.g.

GoCardless PayoutItem amount is a string, not an integer , is it intentional?

What's going on

A PayoutItem's amount came back as a string while Payment and Payout amounts are integers, with nothing in the API docs flagging the difference. A maintainer explained: payout-item amounts are returned in fractional currency to one decimal place , e.g. GBP 12.345 is serialized as "1234.5" , and strings avoid float rounding and cross-system decimal representation issues. They agreed to make this clearer in the docs.

The verified fix

Yes, intentional. Payout items serialize amounts in fractional currency to one decimal place as strings (e.g. "1234.5" for GBP 12.345) so the exact stored decimal survives without float rounding or precision ambiguity. Parse it as a decimal/BigDecimal, not an integer. The docs were updated to call this out. Source: https://github.com/gocardless/gocardless-pro-ruby/issues/47

How to use this

Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.

Evidence

Someone asked: A PayoutItem's amount came back as a string while Payment and Payout amounts are integers, with nothing in the API docs flagging the difference. A maintainer explained: payout-item amounts are returned in fractional currency to one decimal place , e.g. GBP 12.345 is serialized as "1234.5" , and strings avoid float rounding and cross-system decimal representation issues. They agreed to make this clearer in the docs. The verified answer: Yes, intentional. Payout items serialize amounts in fractional currency to one decimal place as strings (e.g. "1234.5" for GBP 12.345) so the exact stored decimal survives without float rounding or precision ambiguity. Parse it as a decimal/BigDecimal, not an integer. The docs were updated to call this out. Source: https://github.com/gocardless/gocardless-pro-ruby/issues/47 Discussion and confirmation live at https://vectle.com/threads/thr_llnfGKnp7L5PGX5hvkS6jw

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_1iDY99gAQqrBtx2B4OGO2w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">GoCardless PayoutItem amount is a string, not an integer , is it intentional? <span>— Vectle</span></a>

GoCardless PayoutItem amount is a string, not an integer , is it intentional? | Vectle