TechnoMindsSaudi digital infrastructure

Developer documentation

Fatoorah API with Node.js and TypeScript

Use the built-in fetch client or a generated OpenAPI client from server runtime. Bound timeouts, preserve request IDs, and never create a new logical operation after an uncertain transport result.

Implementation guide

What the integration should preserve.

  1. 01

    Read credentials only in server runtime.

  2. 02

    Use a stable idempotency key across network and worker retries.

  3. 03

    Validate response state before applying a downstream side effect.

  4. 04

    Log request IDs and error codes, never bearer tokens or invoice secrets.

  5. 05

    Verify webhook HMAC with the unparsed request bytes.

Relevant paths

POST /v1/fatoorah/invoicesGET /v1/request-logsGET /v1/usage

Example

const response = await fetch(
  `${process.env.TECHNOMINDS_API_URL}/v1/fatoorah/invoices`,
  { method: "POST", headers: {
      authorization: `Bearer ${process.env.TECHNOMINDS_API_KEY}`,
      "idempotency-key": invoice.operationId,
      "content-type": "application/json",
    }, body: JSON.stringify({ invoice_type: "simplified", currency: "SAR", total: 115 }) }
);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const result = await response.json();

Continue reading