CodeFaster

CodeFaster

Share this post

CodeFaster
CodeFaster
Don't abuse 0

Don't abuse 0

Tyler Adams's avatar
Tyler Adams
Jan 04, 2024
∙ Paid
4

Share this post

CodeFaster
CodeFaster
Don't abuse 0
Share

Recently I was working with an API that issues credit cards. The killer feature is that you can set a lifetime spend limit. That is when they try to spend more than spend_limit over their whole lifetime, it rejects the auth.

You have no idea how rare this is.

CodeFaster is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

One neat thing you can do is set a spend limit of 0. That’s cool, it makes it easier to make a card with $0 on it, instead of checking if 0, don’t make the card.

Except it doesn’t.

A spend limit of 0, didn’t mean 0. It means INFINITY. As in, you can spend infinite money and nothing will stop you (except daily/monthly limits).

That’s abusing 0. A casual reader/coder will think 0 means 0 because 0 has a natural, conventional meaning. They’ll set the spend limit to 0, and then their customers will spend infinite money and their company goes bankrupt.

If you want to implement infinity, which isn’t a bad idea,…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share