Integration Guide
Get DefendAMinecraft reCAPTCHA up and running on your website in minutes
1
Get Your API Keys
Sign up for a free account and get your site key and secret key from the dashboard.
Your Keys
Site Key: da_live_xxxxxxxxxxxxxxxxxxxxxxxx
Secret Key: da_secret_xxxxxxxxxxxxxxxxxxxxxxxx
2
Add the JavaScript Library
Include our lightweight JavaScript library in your HTML head section.
HTML
<script src="https://api.defendaminecraft.online/v1/recaptcha.js" async defer></script>
3
Add the Widget to Your Form
Place the reCAPTCHA widget in your form where you want the verification to appear.
HTML
<form id="myForm">
<!-- Your form fields -->
<input type="email" name="email" required>
<!-- DefendAMinecraft reCAPTCHA -->
<div class="da-recaptcha"
data-sitekey="your_site_key_here"
data-callback="onRecaptchaSuccess">
</div>
<button type="submit">Submit</button>
</form>
4
Handle the Callback
Add a JavaScript callback function to handle successful verification.
JavaScript
function onRecaptchaSuccess(token) {
// Enable form submission
document.getElementById('submitBtn').disabled = false;
// Store the token for server verification
document.getElementById('recaptcha-token').value = token;
}
5
Verify on Your Server
Verify the token on your server before processing the form submission.
server.js
const axios = require('axios');
async function verifyRecaptcha(token) {
const response = await axios.post('https://api.defendaminecraft.online/v1/verify', {
secret: 'your_secret_key',
response: token
});
return response.data.success;
}
verify.php
<?php
$secret = 'your_secret_key';
$token = $_POST['recaptcha_token'];
$response = file_get_contents('https://api.defendaminecraft.online/v1/verify?' .
http_build_query([
'secret' => $secret,
'response' => $token
])
);
$result = json_decode($response, true);
return $result['success'];
?>
verify.py
import requests
def verify_recaptcha(token):
response = requests.post('https://api.defendaminecraft.online/v1/verify', {
'secret': 'your_secret_key',
'response': token
})
return response.json()['success']
Need Help?
Our integration experts are here to help you get started quickly.