Live data from Hacker News

How to Send a Swift Wire for Developers

iso20022js.com

21–30 of 32 posts

Re: How to Send a Swift Wire for Developers

#22
post #4

Cool to see how swift wire payments works in practice, but using JS floating point numbers for money amounts is a disaster waiting to happen

It would be if it did any arithmetic. But maybe it works without any computation. Then the fp arithmetic is not a problem. Or could you provide an example?

Neither 0.1 nor 0.01 are representable exactly in binary (much like 1/3 is not representable exactly in decimal). Thus means that your cents, if any, are never precise. Not a big deal for Swift transfers where you can safely round to cents. But various commissions, taxes, and fees are often very small fractions, and rounding errors become noticeable with large quantities of small amounts added / subtracted. They may be too small to matter financially, but they are bothersome because your sums do not match exactly where they should, and this affects trust to the system.

IDK about banks; in one billing system where I was involved we used decimals (and clear rules of assignment of the rounding errors), in another, all amounts were in picodollars.

Re: How to Send a Swift Wire for Developers

#23
post #22

Earlier quoted context omitted.

It would be if it did any arithmetic. But maybe it works without any computation. Then the fp arithmetic is not a problem. Or could you provide an example?

Neither 0.1 nor 0.01 are representable exactly in binary (much like 1/3 is not representable exactly in decimal). Thus means that your cents, if any, are never precise. Not a big deal for Swift transfers where you can safely round to cents. But various commissions, taxes, and fees are often very small fractions, and rounding errors become noticeable with large quantities of small amounts added / subtracted. They may…

Yeah, they are not, but still, afaik when I have 0.1 or 0.01 in some variable and pass it around the system it doesn't suddenly change to 0.10000000000012 (or whatever), but the problem arises in case you want to make arithmetic with it, like 0.1 + 0.2 !== 0.3, which you do not do in this library, you just pass "calculated" value how much to send where and you are done.

Partially Im just playing the devils advocate here, I know that you have to use Decimals for working with prices etc., (maybe they did not use it because it will be pretty fat dependency), but still imho it's not needed.

Re: How to Send a Swift Wire for Developers

#24
post #4

Cool to see how swift wire payments works in practice, but using JS floating point numbers for money amounts is a disaster waiting to happen

Thanks for bringing this up chuzz - we're actually only using base amounts for the money representation for amounts here. (no $2.3232321), only (amount: 232)

See the https://dinerojs.com/ package to see how money is handled (tldr it's a combination of currency and amount which helps us get to the root #)

Re: How to Send a Swift Wire for Developers

#25
post #2

Hey HackerNews, I published iso20022js.com a few weeks ago, and I was incredibly surprised by the overwhelming traction it received. I wanted to share more about some payments fundamentals that engineers might need in order to run this package - specifically, how sending these types of bank payments actually works.

> I published iso20022js.com a few weeks ago And from the linked article: > iso20022.js is the most popular open-source library that you can use to create ISO20022 messages programatically How's that possible?

It's the largest one with traction so far! It currently has over 300 stars on Github, meaning it's the largest package that I believe people care about right now

Re: How to Send a Swift Wire for Developers

#26

Nice article! It's always interesting to look behind the scenes of payment infrastructure. BTW, when I tried the interactive demo [1] I noticed that it appended "undefined" to the end of the generated XML. Happens both in Firefox and Chrome, so it doesn't seem to be a browser quirk. [1] https://www.iso20022js.com/demo

Thanks for finding this, I will fix it ASAP!

Re: How to Send a Swift Wire for Developers

#27

But sending the transaction is just ONE part of the ISO. There are a lot of other different messages that are part of the standard: https://www.iso20022.org/iso-20022-message-definitions

Great point hansoolo,

ISO20022 has a huge namespace and can do all kinds of things. My current focus on making transaction banking namespaces more accessible (think pain.001 002 and 008) aswell as CAMT files

Re: How to Send a Swift Wire for Developers

#28
post #3

> you will need to configure the bank to allow for direct transmission. This is a process that your bank will need to complete with you. How easy is this process? Are all banks required to provide such a service? How about countries outside the USA

It is non-trivial. Every corporate bank usually provides some type of treasury services, which is how companies programmatically move money.

As far as I know, this is an international phenomenon. Keep in mind this is corporate banking, not consumer banking.

I'd happy answer any other questions you have @ https://cal.com/woodside/iso20022js

Re: How to Send a Swift Wire for Developers

#29
post #4

Cool to see how swift wire payments works in practice, but using JS floating point numbers for money amounts is a disaster waiting to happen

That seems super dumb indeed. I really wish JSON had an actual decimal type, we already have valid "e" notation (like 10e2), why not have a "d" notation, like 5d3 (meaning 5.3) or 5.3d.

All amounts in this library are in base units (whole numbers) and no arithmetic is used!

For financial calculations I recommend using Dinero.js

Re: How to Send a Swift Wire for Developers

#30
post #29

Earlier quoted context omitted.

That seems super dumb indeed. I really wish JSON had an actual decimal type, we already have valid "e" notation (like 10e2), why not have a "d" notation, like 5d3 (meaning 5.3) or 5.3d.

All amounts in this library are in base units (whole numbers) and no arithmetic is used! For financial calculations I recommend using Dinero.js

So 1 euro is written as 100?
Post reply on HN