Skip to main content

Overview

As soon as your app launches, configure the SDK with your API Key. You’ll receive your public API key from the Encore team.

Configure Encore

import Encore from '@encorekit/capacitor';

// At app startup
await Encore.configure('pk_your_api_key_here');
await Encore.registerCallbacks();
You must call registerCallbacks() after configure() to enable purchase and passthrough event handling.

Configuration Options

await Encore.configure('pk_your_api_key_here', {
  logLevel: 'debug', // 'none' | 'error' | 'warn' | 'info' | 'debug'
});
OptionTypeDefaultDescription
logLevelstring'none'Logging verbosity level
Use logLevel: 'debug' during development, then remove it for production builds.
If you don’t have access to your API key, please contact your Encore representative.

Framework Examples

Angular

// app.component.ts
import { Component, OnInit } from '@angular/core';
import Encore from '@encorekit/capacitor';

@Component({ selector: 'app-root', templateUrl: './app.component.html' })
export class AppComponent implements OnInit {
  async ngOnInit() {
    await Encore.configure('pk_your_api_key_here');
    await Encore.registerCallbacks();
  }
}

React

// App.tsx
import { useEffect } from 'react';
import Encore from '@encorekit/capacitor';

function App() {
  useEffect(() => {
    Encore.configure('pk_your_api_key_here')
      .then(() => Encore.registerCallbacks());
  }, []);

  return <YourApp />;
}

Vue

<!-- App.vue -->
<script setup lang="ts">
import { onMounted } from 'vue';
import Encore from '@encorekit/capacitor';

onMounted(async () => {
  await Encore.configure('pk_your_api_key_here');
  await Encore.registerCallbacks();
});
</script>

Next Steps

Now that Encore is configured, you’re ready to: