PHP Examples
Plain PHP with cURL — no framework required. Full files: examples/php/ in the integration ZIP.
#Minimal client
<?php
function boostigo(string $method, string $path, ?array $body = null): array {
$ch = curl_init("https://api.boostigo.io" . $path);
$headers = ["Authorization: Bearer " . getenv("BOOSTIGO_API_KEY"), "Accept: application/json"];
if ($body !== null) $headers[] = "Content-Type: application/json";
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body !== null ? json_encode($body) : null,
CURLOPT_TIMEOUT => 30,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$json = json_decode((string)$raw, true) ?? ["success" => false, "error" => ["code" => "INTERNAL_ERROR", "message" => "Invalid response"]];
$json["http_status"] = $status;
return $json;
}
#Identify → confirm → recharge
<?php
$id = boostigo("GET", "/likee/user/1137852558");
if (!$id["success"]) { die($id["error"]["code"] . ": " . $id["error"]["message"]); }
$user = $id["data"]["user"];
echo "Recharging {$user['nickname']} ({$user['likee_uid']})\n"; // show this to your customer first
$order = boostigo("POST", "/likee/recharge", [
"likee_id" => $user["likee_id"],
"likee_uid" => $user["likee_uid"],
"diamond" => 5000,
"amount" => "95.00",
"request_id" => "ORDER-CLIENT-10001", // your unique reference
]);
if ($order["success"]) {
$orderId = $order["data"]["order_id"]; // BST-LKE-XXXXXXXX — save it
$status = $order["data"]["status"]; // processing
} else {
echo $order["error"]["code"], ": ", $order["error"]["message"];
}
#Order status
<?php
$o = boostigo("GET", "/orders/BST-LKE-8F72A19X");
echo $o["data"]["status"] ?? $o["error"]["code"];
#Webhook endpoint
See Verify Signature for the complete webhook.php — read the raw body, verify X-Boostigo-Signature, check the timestamp, then process event and return 200.