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));
Last updated