<?php
session_start();
$accessToken = $_SESSION['access_token']; // Token akses yang disimpan

$apiUrl = "https://public.accurate.id/accurate/api/customer/list.do";

// Menggunakan Signature Secret untuk membuat signature (opsional, sesuai dengan dokumentasi API Accurate)
$timestamp = time();
$signature = hash_hmac('sha256', $timestamp . $accessToken, "fPvWlLX0QvIPepZSDWuZEINbSw7oxUI6gdtvxzTOdEotyFnFnAa0TS6BmogYvS3R");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Authorization: Bearer " . $accessToken,
    "X-Accurate-API-Key: f0c07625-c819-4365-95ac-1cefd419cb21",
    "X-Accurate-API-Signature: $signature",
    "X-Accurate-API-Timestamp: $timestamp"
));
$response = curl_exec($ch);
curl_close($ch);

$customers = json_decode($response, true);
print_r($customers);
?>
