No Facta library required
Call the public Supabase function URL directly. Keep API keys and signing keys on your server.
Prerequisite
PHP + cURL extension
Example
<?php
$payload = json_encode(['tipoDte' => '01', 'items' => [['descripcion' => 'Servicio', 'cantidad' => 1, 'precioUni' => 10.0]]], JSON_THROW_ON_ERROR);
$request = curl_init(rtrim(getenv('FACTA_API_BASE_URL'), '/') . '/v1/dte');
curl_setopt_array($request, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-Facta-Key: ' . getenv('FACTA_API_KEY'), 'X-Facta-Sign-Key: ' . getenv('FACTA_SIGN_KEY'), 'Idempotency-Key: order-123']]);
$body = curl_exec($request);
if ($body === false || curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) throw new RuntimeException(curl_error($request) ?: $body);
echo $body;
See the HTTP reference for headers, responses and recovery rules.