Documentation

Laravel guide

Send the payment from the application that owns the order, using Laravel's HTTP client. The JSON matches @analyticfast/node: amount_minor and currency. There is no PHP SDK. Put the token in .env, not in a blade view or a committed config file.

use Illuminate\Support\Facades\Http;

public function recordPayment(Order $order, ?string $visitorId): void
{
    $payload = [
        'transaction_id' => (string) $order->id,
        'type' => 'payment',
        'amount_minor' => $order->total_minor, // 2999 = $29.99
        'currency' => $order->currency,        // USD
    ];
    if ($siteId = config('services.analyticfast.site_id')) {
        $payload['site_id'] = $siteId;
    }
    if ($visitorId) {
        $payload['visitor_id'] = $visitorId;
    }
    Http::withToken(config('services.analyticfast.token'))
        ->acceptJson()
        ->timeout(10)
        ->post(rtrim(config('services.analyticfast.base_url'), '/').'/api/v1/payments', $payload)
        ->throw();
}

withToken sets Authorization: Bearer. Call this from the controller that already knows the order is paid. The visitor id is the website ml_vid you saved at checkout, not a value Laravel generates. A queue retry with the same transaction_id does not double-count. A refund is a second POST with type refund, its own transaction_id, original_transaction_id, and optional amount_minor plus currency for a partial refund.

Official reference, checked 2026-10-26: HTTP client bearer tokens.

Questions, answered.

How do I use laravel with AnalyticFast?

Follow the Laravel instructions on this page using your own website’s Site ID and configuration. Verify a real event before relying on the reports.

Where can I get setup help?

Contact support@analyticfast.com with the website domain and a redacted description. Do not send API tokens, signing secrets or personal customer data.