DEV Community

ankitx1357-boop
ankitx1357-boop

Posted on

How I built a Sovereign AI Payment Node using Node.js & Render.

const axios = require('axios');

// 🔴 PASTE YOUR RENDER URL HERE (No slash at the end)
const BASE_URL = "https://tollgate-live-1.onrender.com";

async function verifyTheGold() {
console.log(🎯 Target: ${"https://tollgate-live-1.onrender.com"});

try {
    // STEP 1: Pay $1.00
    console.log("1. 💸 Sending $1.00 Premium Payment...");

    const payResponse = await axios.post(`${BASE_URL}/pay`, {
        agent_id: "Big-Spender-Bot",
        amount: 1.00  // <--- UPDATED PRICE
    });

    const token = payResponse.data.access_token;
    console.log("   ✅ Payment Accepted! Token received.");

    // STEP 2: Get Data
    console.log("2. 🔓 Accessing Premium Vault...");

    const goldResponse = await axios.get(`${BASE_URL}/premium-data`, {
        headers: { 'Authorization': token }
    });

    // STEP 3: Result
    console.log("\n   🎉 SUCCESS! DATA RECEIVED:");
    console.log("   ========================================");
    console.log("   ITEM:  " + goldResponse.data.item);
    console.log("   PRICE: " + goldResponse.data.price);
    console.log("   ========================================");

} catch (error) {
    console.error("\n❌ FAILED.");
    if (error.response) {
         console.error("   Server Message:", error.response.data);
    } else {
         console.error("   Error:", error.message);
    }
}
Enter fullscreen mode Exit fullscreen mode

}

verifyTheGold(); "Most people block bots. I decided to tax them." #javascript, #webdev, #showdev, #ai.

Top comments (0)