Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.bitgpt.xyz/llms.txt

Use this file to discover all available pages before exploring further.

Validate signature function

Take the validate signature snippet from our recipes, it’ll be used below and it’s important for security.

Create a Webhook endpoint

Use your dashboard to set up a webhook endpoint and receive real-time event notifications.
Webhook.php
$rawBody = file_get_contents("php://input");
$headers = getallheaders();
$secret = 'your-webhook-secret';

if (!validate_webhook($headers, $rawBody, $secret)) {
  http_response_code(400);
  echo json_encode(["error" => "Invalid signature"]);
  exit;
}

$event = $headers['X-Webhook-Event'] ?? '';
$body = json_decode($rawBody, true);

switch ($event) {
  case 'invoice.completed':
    // handleInvoiceCompleted($body);
    break;
  default:
    error_log("Unhandled event: $event");
    break;
}

http_response_code(200);
echo "OK";