Menu

Typing a crypto payments API from its OpenAPI spec, and the gaps the types won't cover
📰

Typing a crypto payments API from its OpenAPI spec, and the gaps the types won't cover

DEV Community: typescript·Coldtill·3 days ago
#pAi1E8hh
#devtotypescript#devto#dev#error#string
Long article (2323 words) — no AI summary yet.
Reading 0:00
15s threshold

Most payment integrations I've reviewed have the same bug somewhere: a field name typed from memory. customerId instead of customerID , reference_id in one place and referenceID in another, a status compared against a string that the API never sends. JavaScript is happy to send all of those, and the API answers with a 400 or, worse, quietly ignores the field.

If the API publishes an OpenAPI spec, you can make the compiler catch those for you. This post does that for Coldtill, a self-hosted crypto payment gateway , whose merchant API is described in a single OpenAPI 3.1 file at coldtill.com/openapi.yaml .…

Continue reading — create a free account

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