EdfaPay Logo

SDK Initialization

Learn how to properly initialize the EdfaPay Soft POS in your Android application. This step is critical for establishing a secure connection with the payment gateway.

Basic Setup

Initialization should occur in your Application class or the main Activity's onCreate method. The EdfaPayPlugin.initiate method configures the SDK with your credentials and environment settings.

Loading...

Important

Always initialize the SDK before attempting any payment operations. Calling payment methods before initialization will result in errors.

Terminal Binding

New in v1.0.5

The onTerminalBindingTask callback is invoked when terminal selection is required. This typically happens during:

  • First-time setup: When the device has not been bound to a terminal yet
  • Multi-terminal scenarios: When multiple terminals are available for the merchant
  • Terminal changes: When switching between terminals on the same device

When is this callback triggered?

This callback is not always called. If a terminal is already bound and valid, the SDK proceeds directly to onSuccess. The callback is only triggered when terminal selection is needed.

Handling Terminal Binding

Loading...

TerminalBindingTask API

Example.kt
Loading...

bind()

Shows the SDK's built-in terminal selection UI. Simplest approach for most integrations.

terminals

Access the list of available terminals to build your own custom selection UI.

refresh()

Fetch the latest terminals list from the server if the list may be stale.

Authentication Options

The SDK supports multiple authentication methods depending on your integration type. Choose the one that best fits your security model.

RecommendedMethod 1: Auth Token

Ideal for server-to-server integrations where the token is generated on your backend. This is the most secure method as credentials are never stored on the device.

Loading...

Method 2: Email & Password

Direct authentication suitable for testing or standalone applications. Not recommended for production due to credential storage concerns.

Loading...

Security Warning

Never hardcode credentials in your application. Use secure storage mechanisms like Android Keystore or retrieve tokens from your backend server.

Environment Options

Configure the target environment for SDK operations. Always use SANDBOX during development.

EnvironmentDescription
Env.DEVELOPMENTLocal and internal development environment.
Env.STAGINGStaging environment for previewing releases or pre-production testing.
Env.SANDBOXSandbox environment for development and testing integrations with fake transactions.
Env.PRODUCTIONProduction environment for real money transactions. Requires Live Keys.

Environment Detection

Use build variants to automatically switch environments based on your build type:

val env = if (BuildConfig.DEBUG) Env.SANDBOX else Env.PRODUCTION