Four production concerns
Four cross-cutting concerns decide whether a Recurso integration survives production: reading errors, retrying transient failures safely, using idempotency keys so retries don’t double-charge, and paging through lists without missing rows. Each SDK expresses these in its own idiom — this guide shows all three side by side.The biggest difference between SDKs is how a failed request surfaces.
Node throws, Go returns a typed error, and the Python client does not raise
for documented 4xx/5xx statuses — it returns an
Error model in the return
union. Read the next section before writing any error handling.How errors surface
{"error": {"code", "message"}} — where code is a stable machine-readable
string (NOT_FOUND, VALIDATION_ERROR, …) and message is human-readable.
Retrying transient failures
Retry only transient failures — HTTP429 (rate limited) and 5xx
(server-side), plus connection/timeout errors. Never retry a 4xx like
400/404/409; those are deterministic and a retry just repeats the failure.
Back off exponentially between attempts.
Add jitter and a cap in production, and honor a
Retry-After header on 429
when present. The examples keep the schedule fixed for clarity.Idempotency
Retrying a money-moving or ingestion call is only safe if the server can tell a retry from a genuinely new request. Recurso’s usage-ingestion path takes a caller-suppliedtransaction_id: a retried event with the same
(subscription, transaction_id) collapses to the original instead of
double-counting (the response reports the original event and a duplicate
status).
Generate the key once per logical event, before the first attempt, and reuse
the same key on every retry.
Pagination
List endpoints default to a small page. Always pass an explicitlimit and loop
until a short page comes back.
Page-based loop over a resource list (plans):
offset by the
page size instead of incrementing a page number:
Related
- Managing webhook endpoints — deliveries and redelivery
- Usage-based billing — where
transaction_idmatters most - SDK overview — shared concepts (auth, minor units, base URL)
- Node guide · Go guide · Python guide