TechnoMindsSaudi digital infrastructure

Developer documentation

Fatoorah API with PHP and Laravel

Use Laravel's HTTP client from a queued or request-scoped service, load the sandbox key from server configuration, assign one stable operation key, and store the returned request ID beside the source invoice.

Implementation guide

What the integration should preserve.

  1. 01

    Keep the developer key in an encrypted server-side environment or secret store.

  2. 02

    Generate the idempotency key from the logical invoice operation, not the queue attempt.

  3. 03

    Persist the TechnoMinds request ID and lifecycle state with the accounting record.

  4. 04

    Verify webhook signatures against the exact raw body before dispatching jobs.

  5. 05

    Treat the public sandbox result as synthetic, not external ZATCA acceptance.

Relevant paths

POST /v1/fatoorah/invoicesGET /v1/fatoorah/invoices/:idPOST /v1/webhook-endpoints

Example

use Illuminate\Support\Facades\Http;

$response = Http::withToken(config('services.technominds.key'))
  ->withHeaders(['Idempotency-Key' => $invoice->operation_key])
  ->post(config('services.technominds.url').'/v1/fatoorah/invoices', [
    'invoice_type' => 'simplified', 'currency' => 'SAR', 'total' => 115,
  ])->throw()->json();

$invoice->update(['provider_request_id' => $response['request_id']]);

Continue reading