Check Token Code API
Verify token code details including validity, discount rate, and usage status
Check Token Code API
Verify token code details before redemption. Check if a token is valid, view its discount rate, and see usage status.
Verify Tokens
Check token validity.
View Details
See discount and expiry.
Status Check
Confirm active or used.
Endpoint Overview
/graphqlCheck the details and validity of a token code without redeeming it. Returns information about the token's status, discount rate, and associated user.
Request Parameters
codeString!RequiredThe token code to check.
GraphQL Mutation
mutation checkTokenCode($code: String!) {
checkTokenCode(code: $code) {
id
userId
tokenCode
discountRate
isActive
usedTimestamp
createdAt
}
}Variables:
{
"code": "TKN-ABCD-1234-EFGH"
}HTTP Request:
curl -X POST https://api.orbnet.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"query": "mutation checkTokenCode($code: String!) { checkTokenCode(code: $code) { id tokenCode discountRate isActive } }",
"variables": {
"code": "TKN-ABCD-1234-EFGH"
}
}'Response
{
"data": {
"checkTokenCode": {
"id": "token_456",
"userId": "12345",
"tokenCode": "TKN-ABCD-1234-EFGH",
"discountRate": 25,
"isActive": true,
"usedTimestamp": null,
"createdAt": "2024-01-10T10:00:00Z"
}
}
}{
"data": {
"checkTokenCode": {
"id": "token_456",
"userId": "12345",
"tokenCode": "TKN-ABCD-1234-EFGH",
"discountRate": 25,
"isActive": false,
"usedTimestamp": "2024-01-15T14:30:00Z",
"createdAt": "2024-01-10T10:00:00Z"
}
}
}{
"errors": [
{
"message": "Token code not found",
"path": ["checkTokenCode"],
"extensions": {
"code": "NOT_FOUND"
}
}
],
"data": null
}Token Status
Active
Token is valid and ready to use.
Used
Token has been redeemed.
Expired
Token validity period ended.
Invalid
Token code doesn't exist.
Use Cases
Pre-Checkout Validation
Verify before applying discount.
Support Lookup
Help users with token issues.
Fraud Prevention
Detect invalid or reused tokens.
Audit Trail
Track token usage history.
Best Practices
Check Before Use
Always validate tokens first.
Display Status
Show clear status to users.
Handle Errors
Gracefully handle invalid codes.
User Matching
Verify token belongs to user.
Related Endpoints
Non-Redeeming
Checking a token code does not redeem it. Use the Use Token Code API to actually apply the discount.
Ready to Redeem?
After verifying, apply the token to receive the discount.