Cricap Mini App SDK Documentation
By Cricap ยท Updated ยท Contact the team
Using the current Trends host? Start with the Trends integration guide. It describes the supported bridge and review flow. This API reference covers broader SDK interfaces; do not assume every interface is available in the embedded web host. Check the SDK source for version-specific details.
Official JavaScript SDK for building mini apps on the Cricap platform. Build, deploy, and monetize your games with seamless integration.
๐ Quick Start
npm install @cricap/miniapp-sdk
import { initCricapSDK } from '@cricap/miniapp-sdk';
const sdk = initCricapSDK({
appId: 'miniapp_your_id',
environment: 'production',
debug: true,
});
const result = await sdk.initialize();
if (result.success) {
await sdk.ui.show({ animation: 'slide-up' });
}
Overview
The Cricap Mini App Ecosystem enables third-party developers to build applications that run within the Cricap platform. This SDK provides seamless integration with authentication, user data, leaderboards, wallet, and real-time notifications.
Installation
npm
npm install @cricap/miniapp-sdk
yarn
yarn add @cricap/miniapp-sdk
SDK Initialization
| Option | Type | Required | Description |
|---|---|---|---|
appId | string | โ | Your mini app unique identifier |
environment | string | โ | development, staging, or production |
debug | boolean | โ | Enable debug logging |
UI Container Methods
Show Mini App
await sdk.ui.show({
animation: 'slide-up',
style: 'sheet',
overlay: true,
closeOnBackdrop: true
});
Notification System
await sdk.notifications.subscribe([
'leaderboard.updates',
'wallet.transactions'
]);
sdk.notifications.onNotification((notification) => {
console.log('Received:', notification);
});
Backend API - Authentication
Base URLs
| Environment | Base URL |
|---|---|
| Production | https://api.cricap.com/v1 |
| Staging | https://api-staging.cricap.com/v1 |
Token Exchange
// Request
{
"grantType": "authorization_code",
"code": "auth_code_from_container",
"appId": "miniapp_abc123",
"appSecret": "sk_live_xxxxxxxx"
}
// Response
{
"success": true,
"data": {
"accessToken": "eyJhbGciOiJSUzI1NiIs...",
"refreshToken": "rt_xxxxxxxx",
"tokenType": "Bearer",
"expiresIn": 3600
}
}
Backend API - User
Get User Profile
// Response
{
"success": true,
"data": {
"userId": "user_xyz789",
"username": "gamer123",
"displayName": "Pro Gamer",
"avatarUrl": "https://cdn.cricap.com/avatars/xyz789.png"
}
}
Backend API - QCoin System
Update QCoin Balance
// Request
{
"amount": 100,
"reason": "Game reward"
}
// Response
{
"message": "QCoin balance updated",
"balance": 500,
"change": 100
}
Webhooks
Event Types
| Event Type | Description |
|---|---|
user.auth | User authentication event |
user.wallet.update | Wallet balance changed |
qcoin.update | QCoin balance updated |
Frequently Asked Questions
How do I install the Cricap Mini App SDK?
Install using npm: npm install @cricap/miniapp-sdk
What is the base URL for the Cricap API?
Production: https://api.cricap.com/v1, Staging: https://api-staging.cricap.com/v1
How do I authenticate with the Cricap API?
Use the /auth/token endpoint to exchange an authorization code for an access token.