Skip to main content
This section documents the Encore Web SDK’s complete public API in a consistent format with clean parameter tables, comprehensive usage examples, and best practices.
Looking for integration guides?
  • New to Encore? Start with the Getting Started Guide for portal-guided setup
  • Step-by-step integration: See the Web Quickstart for detailed installation and configuration instructions
  • Framework patterns: Check the Framework Integration Guide for React, Vue, Angular examples
  • Advanced setups: This reference section is ideal for looking up specific methods, parameters, and advanced usage patterns

Core Methods


User Management


Event Handling & Reactive Updates


Grant Signals & Verification


Error Handling


Quick Reference Example

Here’s a complete example showing the most common SDK methods:
import Encore from '@encore/web-sdk';

// 1. Configure SDK
Encore.configure({
  apiKey: 'pk_your_api_key_here',
  logLevel: 'debug'
});

// 2. Identify user (optional)
Encore.identify('user-123', {
  email: 'user@example.com',
  subscriptionTier: 'free'
});

// 3. Present offer
const result = await Encore.presentOffer();

if (result.granted) {
  console.log('Entitlement granted:', result.entitlement);
}

// 4. Check entitlements
if (Encore.isActive({ type: 'freeTrial' })) {
  unlockPremiumFeatures();
}

// 5. Subscribe to changes
const unsubscribe = Encore.on('entitlementChanged', (event) => {
  console.log('Entitlement changed:', event);
  updateUI();
});

// 6. Cleanup
unsubscribe();

TypeScript Support

The SDK includes comprehensive TypeScript type definitions:
import Encore, {
  type EntitlementType,
  type EntitlementScope,
  type PresentationResult,
  type UserAttributes,
  type EncoreConfig,
  type EncoreError
} from '@encore/web-sdk';

// Types are automatically inferred
const result: PresentationResult = await Encore.presentOffer();
const isActive: boolean = Encore.isActive({ type: 'freeTrial' });

Method Categories

Initialization

  • configure() - Initialize the SDK
  • getVersion() - Get SDK version
  • setLogLevel() - Change log level

User Identity

  • identify() - Identify users
  • getCurrentUserId() - Get current user ID
  • setUserAttributes() - Set user attributes
  • getUserAttributes() - Get user attributes
  • reset() - Reset all user data

Offer Presentation

  • presentOffer() - Show offers with promises/callbacks
  • placement() - Fluent builder for offers

Entitlement Checking

  • isActive() - Check entitlement status
  • refreshEntitlements() - Manually refresh
  • on() - Subscribe to changes
  • observeEntitlement() - Observe specific entitlement

Grant Signals

  • didGrant() - Send grant signals
  • waitForVerification() - Poll for verification

Next Steps

Explore the detailed documentation for each method, or return to the integration guides: