TypeScript-first Node.js SDK for PlayCamp API integration
The official Node SDK (@playcamp/node-sdk) provides a type-safe way to integrate with the PlayCamp API. It handles authentication, pagination, retries, and error handling.
Installation
npm install @playcamp/node-sdk
Requirements: Node.js >= 18.0.0
Quick Start
import { PlayCampServer } from '@playcamp/node-sdk';const server = new PlayCampServer('your_server_key:your_secret', { environment: 'sandbox',});// Create a boostconst sponsor = await server.sponsors.create({ userId: 'user_12345', creatorKey: 'ABC12',});// Register a paymentconst payment = await server.payments.create({ userId: 'user_12345', transactionId: 'txn_abc123', productId: 'gem_pack_100', amount: 9900, currency: 'KRW', platform: 'Android', distributionType: 'MOBILE_STORE', purchasedAt: new Date(),});
Client vs Server
The SDK provides two classes depending on your API key type:
Class
API Key
Access
Use Case
PlayCampClient
Client Key
Read-only
Game client, public queries
PlayCampServer
Server Key
Read/Write
Game server, all operations
import { PlayCampClient, PlayCampServer } from '@playcamp/node-sdk';// Read-only access (Client Key)const client = new PlayCampClient('your_client_key:your_secret');// Full access (Server Key)const server = new PlayCampServer('your_server_key:your_secret');
Never use PlayCampServer or expose your Server Key on the client side.