TechnoMindsSaudi digital infrastructure

Developer documentation

Fatoorah API with .NET

Use a named HttpClient, keep the bearer credential in managed configuration, send a stable idempotency key, and store the returned request identity for logs, webhooks, and support.

Implementation guide

What the integration should preserve.

  1. 01

    Use IHttpClientFactory rather than creating a client for every request.

  2. 02

    Keep credentials in server-side configuration protected by the deployment platform.

  3. 03

    Apply retries only to explicitly safe transport failures.

  4. 04

    Read the structured error response before deciding an operation can be repeated.

  5. 05

    Verify webhook signatures before deserializing into domain events.

Relevant paths

POST /v1/fatoorah/invoicesPOST /v1/webhook-endpoints

Example

using var request = new HttpRequestMessage(HttpMethod.Post, "/v1/fatoorah/invoices");
request.Headers.Authorization = new("Bearer", options.ApiKey);
request.Headers.Add("Idempotency-Key", invoice.OperationId);
request.Content = JsonContent.Create(new {
  invoice_type = "simplified", currency = "SAR", total = 115
});
using var response = await client.SendAsync(request, cancellationToken);
response.EnsureSuccessStatusCode();

Continue reading