getTopupProduct

Last Updated 11th May, 2025

The getTopupProduct query fetches a single top-up product by its productId. It requires authentication via an API key and returns only the product's name, ID, and price if found.


🔗 Endpoint

URL: https://api.vscgames.com/graphql Method: POST Content-Type: application/json


🔍 Query Structure

query getTopupProduct($productId: String!) {
  getTopupProduct(productId: $productId) {
    name
    productId
    price
  }
}

📥 Parameters

Name
Type
Required
Description

productId

String

✅ Yes

The ID of the product to fetch

📥 Headers

Header
Required
Description

apikey

✅ Yes

API key of the user


✅ Successful Response

{
  "data": {
    "getTopupProduct": {
      "name": "Free Fire 110 Diamonds",
      "productId": "abc123",
      "price": 1.66
    }
  }
}

⚠️ Null Response

If the product is not found:

{
  "data": {
    "getTopupProduct": null
  }
}

🚫 Error Responses

Message
Reason

API key required in headers

Missing apikey from request

Invalid API key

The key does not belong to a user


🧪 Code Examples

Python

import requests

url = "https://api.vscgames.com/graphql"
headers = {
    "Content-Type": "application/json",
    "apikey": "YOUR_API_KEY"
}

query = """
query getTopupProduct($productId: String!) {
  getTopupProduct(productId: $productId) {
    name
    productId
    price
  }
}
"""

variables = { "productId": "abc123" }

response = requests.post(url, json={"query": query, "variables": variables}, headers=headers)
print(response.json())

JavaScript

const fetch = require("node-fetch");

const query = `
query getTopupProduct($productId: String!) {
  getTopupProduct(productId: $productId) {
    name
    productId
    price
  }
}`;

const variables = { productId: "abc123" };

fetch("https://api.vscgames.com/graphql", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "apikey": "YOUR_API_KEY"
  },
  body: JSON.stringify({ query, variables })
})
  .then(res => res.json())
  .then(data => console.log(data));

Last updated