vscgames
  • Welcome
  • Getting Started
    • CreateAPIKey
    • CreateMerchantKey
  • Products
  • Mutations
    • buyVoucher
    • FreeFireTopupOrder
    • DeltaForceTopupOrder
    • FreeFireMerchantTopup
    • DeltaForceMerchantTopupOrder
  • Queries
    • getProductsByCategory
    • getProductById
    • getOrderById
    • getUserOrders
    • getTopupsProducts
    • getTopupProduct
    • getPlayerDetails
    • getTopupOrder
    • getUserTopupOrders
  • REST API
    • COMING soon
  • CONTACT
    • Support
Powered by GitBook
On this page
  1. Queries

getOrderById

Last Updated 11th May, 2025

The getOrderById query allows authenticated users to retrieve a specific transaction by its orderId. It validates the API key, ensures the user owns the order, and returns the full order object.


๐Ÿ”— Endpoint

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


๐Ÿ” Query Structure

query getOrderById($orderId: String!) {
  getOrderById(orderId: $orderId) {
    code
    message
    order {
      orderId
      productId
      name
      amount
      quantity
      playerID
      player_name
      status
      ordertime
      date
    }
  }
}

๐Ÿ“ฅ Parameters

Name
Type
Required
Description

orderId

String

โœ… Yes

The unique identifier of the order

๐Ÿ“Œ Header Required:

apikey: YOUR_API_KEY

โœ… Successful Response

{
  "data": {
    "getOrderById": {
      "code": 200,
      "message": "Order retrieved successfully",
      "order": {
        "orderId": "ORD123456",
        "productId": "abc123",
        "name": "Free Fire 110 Diamonds",
        "amount": 1.66,
        "quantity": 1,
        "playerID": "2265245647",
        "player_name": "JJ_MUCH",
        "status": "successful",
        "ordertime": "2025-05-11T15:30:00Z",
        "date": "2025-05-11T15:30:00Z"
      }
    }
  }
}

๐Ÿšซ Error Responses

Code
Message
Reason

401

API key required

apikey header is missing

403

Invalid API key

Provided API key does not match any user

403

Unauthorized access to this order

Order doesn't belong to authenticated user

404

Order not found

Order ID does not exist


๐Ÿงช Code Examples

Python

import requests

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

query = """
query getOrderById($orderId: String!) {
  getOrderById(orderId: $orderId) {
    code
    message
    order {
      orderId
      productId
      name
      amount
      quantity
      playerID
      player_name
      status
      ordertime
      date
    }
  }
}
"""

variables = {
  "orderId": "ORD123456"
}

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

JavaScript

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

const query = `
query getOrderById($orderId: String!) {
  getOrderById(orderId: $orderId) {
    code
    message
    order {
      orderId
      productId
      name
      amount
      quantity
      playerID
      player_name
      status
      ordertime
      date
    }
  }
}`;

const variables = { orderId: "ORD123456" };

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));
PreviousgetProductByIdNextgetUserOrders

Last updated 23 days ago