SDK Initialization

Initializing the Pensa SDK is straightforward. Follow the steps below to set up the SDK with your credentials and start using its features.

1- Initializing PensaSdk

Call initPensa() at the startup of your app, preferably in a root file like index.js before calling AppRegistry.registerComponent.

import {initPensa} from 'pensa-sdk-react-native';

initPensa({
  clientId: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_CLIENT_SECRET',
  isLoggingEnabled: true,
})
  .then(() => {
    console.log('[Pensa] SDK init success');
  })
  .catch((error) => {
    console.log('[Pensa] SDK init error:', error);
  });

2- Add Listeners (Optional)

Event Name
Payload Fields

onScanUploadProgressUpdate

tdlinxId, scanAreaId, progress

onScanUploadCompleted

tdlinxId, scanAreaId

onScanUploadFailed

tdlinxId, scanAreaId, error

onCantScanReported

tdlinxId, scanAreaId, reason

To listen to SDK events such as upload progress, success, or failure, you can create a helper hook like below:

Then call the hook in your component:

This will automatically register and clean up all supported event listeners.

Once initialized, you can use any of the SDK methods like showShelfScans, showStoresScreen, or showScanArea.

Last updated

Was this helpful?