Configures the shared Encore instance for use throughout your app. This must be called once, typically at app startup, before using any other SDK methods.
Call configure() before using any other SDK methods.
Signature
configure(apiKey: string, options?: ConfigureOptions): Promise<{ success: boolean }>
Parameters
| Name | Type | Default | Description |
|---|
apiKey | string | — | Your Live Key or Test Key from the Encore Dashboard settings |
options | ConfigureOptions | {} | Optional configuration |
Options
| Option | Type | Default | Description |
|---|
logLevel | 'none' | 'error' | 'warn' | 'info' | 'debug' | 'none' | Logging verbosity level |
API keys
| Key Type | Format | Description |
|---|
| Live Key | pk_live_... | Production key with standard geo-filtering based on offers’ configured regions |
| Test Key | pk_test_... | Testing key that bypasses geo-filtering for development |
Use the test key (pk_test_...) during development to test offers from any location without geo-filtering restrictions.
Always use your live key (pk_live_...) in production builds.
Usage
EncoreProvider (Recommended)
import { EncoreProvider } from '@tryencorekit/react-native';
export default function App() {
return (
<EncoreProvider apiKey="pk_your_api_key">
<YourApp />
</EncoreProvider>
);
}
Manual Configuration
import Encore from '@tryencorekit/react-native';
await Encore.configure('pk_your_api_key');
await Encore.registerCallbacks();
With Debug Logging
await Encore.configure('pk_your_api_key', {
logLevel: __DEV__ ? 'debug' : 'none',
});
Use logLevel: 'debug' during development to see detailed SDK logs, then use 'none' for production builds.