Menu

Our database can hold a Stripe customer id that Stripe has never heard of, and four pieces of code answer that differently
📰

Our database can hold a Stripe customer id that Stripe has never heard of, and four pieces of code answer that differently

DEV Community: typescript·Daniel Pertu·6 days ago
#cyCKJn7t
#devtotypescript#devto#dev#stripe#customer
Reading 0:00
15s threshold

Every account in PubTrivia has a stripe_id column, written once at signup, long before anybody has decided to pay for anything. It is a string that points at a customer object in somebody else's database, and the thing about a pointer into somebody else's database is that it can stop resolving.

Three ways it happens, in rough order of how often:

The account was created while the app was running on test keys. Live Stripe answers No such customer for a cus_ id that only exists in test mode, and will do so forever.

The customer was deleted in the Stripe dashboard, which is a thing you do while cleaning up after yourself and do not think of as touching production data.

The id is from a different Stripe account entirely, which happens exactly once per project and is memorable.

So the question is not whether a broken id can exist. It is what each reader of that column does when it turns out to be broken.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.