Webhook setup
To begin receiving events, you must:- Create a webhook endpoint for the signature following the format described below.
- Register the webhook with Appcharge via the Publisher Dashboard.
- Select and enable the events you want to receive in the Events Center.
HTTPS POST requests to your endpoint containing JSON payloads that describe each event.
Event payload structure
Webhook events are sent as structured JSON objects, and the fields included can vary depending on the event type. Some fields may be optional, so your integration should account for missing fields gracefully to maintain reliability. This approach ensures compatibility as the event schema evolves and new fields are introduced.Webhook signature verification
To ensure the authenticity and integrity of webhook events, Appcharge signs each request using a cryptographic signature. Only requests with valid signatures should be accepted. Signature validation protects you from:- Forged or malicious requests.
- Payload tampering.
- Replay attacks with outdated data.
- Unauthorized access to internal systems.
Signature generation
We use HMAC-SHA256 with the following components:- Timestamp: Unix timestamp in milliseconds.
- Payload: The full JSON body of the webhook.
- Secret: Your private signing key.
Signature format
The signature is included in thesignature header using this format:
Headers included in the request
Content-Type: application/jsonsignature: t={timestamp},v1={signature}x-project-id: 1234: Project ID. Located in the Publisher Dashboard under Settings > Company > Project ID.x-publisher-token: xxxxx: Publisher token found in the Publisher Dashboard under Settings > Integration.
Signature algorithm details
- Algorithm: HMAC-SHA256
- Input Format:
{timestamp}.{json_payload} - Output: Hex-encoded string
- Timestamp: Unix timestamp in milliseconds
Signature validation process
These steps demonstrate how you can validate the webhook before processing:Step 1 | Extract signature components
Step 2 | Validate timestamp (replay protection)
We recommend using a 5-minute tolerance window. Adjust this window according to your network conditions and security requirements.Step 3 | Reconstruct expected signature
Step 4 | Compare signatures
Complete code example
Security best practices
- Always validate webhook signatures before processing.
- Keep your secret key private, and never expose it in frontend or logs.
- Use HTTPS for all webhook communication.
- Set an appropriate timestamp tolerance. Start with 5 minutes and adjust as needed.
- Use realistic validation during development to prevent unsafe patterns.
Session ID
Some webhook events include asessionId property that identifies the player’s current session. This value helps track player behavior across interactions such as logins, purchases, or visits to the web store.
A session begins when a player logs in or returns to the web store, and it ends either after 30 minutes of inactivity or when the player logs out. If the player opens the store in multiple tabs within the same browser, those tabs will share the same sessionId. However, accessing the store in a different browser or on another device will generate a new session ID.
Use the sessionId to group related events and gain insight into player activity within a single session.