Cricap Mini App SDK Documentation
Official JavaScript SDK for building mini apps on the Cricap platform. Build, deploy, and monetize your games with seamless integration.
🎉 v1.1.0 Released! New Mini App Ecosystem, QCoin system, and enhanced API endpoints.
🚀 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
POST
/auth/token
// 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
GET
/users/me
// 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
POST
/qcoin/update
// 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.