title: “Partner API Requirements”
description: “API endpoints that partners must implement for Stock Games integration”Overview
This guide outlines the API requirements that partners must implement to integrate with Stock Games. Partners need to provide a service-based API that Stock Games will use to manage user wallet operations during gameplay.Partners must provide their Base URL and API Key to Stock Games during the onboarding process for secure communication.
Authentication
All requests from Stock Games include Bearer token authentication:Required Endpoints
Your API service must implement these three endpoints:Get Wallet Balance
Purpose: Retrieve the current wallet balance for a user
Deduct Balance
Purpose: Deduct amount from user’s wallet when placing bets
Deposit Balance
Purpose: Add winnings to user’s wallet
Error Handling
Your API should return appropriate HTTP status codes:200- Success400- Bad Request (invalid parameters)401- Unauthorized (invalid API key)404- Not Found (user not found)422- Unprocessable Entity (insufficient funds, etc.)500- Internal Server Error
Integration Flow
1
Game Access
User requests to play a game through your platform
2
Balance Check
Stock Games calls your
/wallet/balance endpoint3
Bet Placement
When user places bet, Stock Games calls
/wallet/deduction4
Game Result
If user wins, Stock Games calls
/wallet/deposit5
Balance Update
User’s wallet reflects the latest balance
Security Requirements
HTTPS Only
All API endpoints must use HTTPS encryption
API Key Validation
Validate the Bearer token on every request
Rate Limiting
Implement appropriate rate limiting to prevent abuse
Request Validation
Validate all incoming request parameters