SC CEK ID APIGAMES
fauzielay12
700 x views • 2 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cek ID Game</title>
</head>
<body>
<h1>Cek ID Game</h1>
<form id="form-cek-id">
<label for="user-id">Masukkan User ID:</label>
<input type="text" id="user-id" name="user-id" required>
<button type="submit">Cek ID</button>
</form>
<div id="hasil-api"></div>
<script>
document.getElementById('form-cek-id').addEventListener('submit', function (event) {
event.preventDefault();
const userId = document.getElementById('user-id').value;
const merchantId = 'M220513JBQU7979BK';
const apiUrl = `https://v1.apigames.id/merchant/${merchantId}/cek-username/mobilelegend?user_id=${userId}&signature= masukan signature`;
// Menggunakan fetch() untuk memanggil API dengan metode GET
fetch(apiUrl)
.then(response => {
// Mengubah respons ke format JSON
return response.json();
})
.then(data => {
// Menangani data JSON yang diterima dari API
const hasilApiDiv = document.getElementById('hasil-api');
hasilApiDiv.innerHTML = `<strong>Status:</strong> ${data.status}<br>
<strong>Pesan:</strong> ${data.message}<br>
<strong>Is Valid:</strong> ${data.data.is_valid}<br>
<strong>Username:</strong> ${data.data.username}`;
})
.catch(error => {
// Menangani kesalahan jika ada
console.error('Error:', error);
});
});
</script>
</body>
</html>