Pre-requisites
To ensure compatibility and optimal performance, your Android project must meet the following minimum requirements:- Android 5.0 (API level 21).
- The Nayax eCom SDK is compiled with Android API level 34. The SDK has been tested and approved with Android versions up to Android 14
- A valid Sign Key (shared by Nayax, typically 16 characters).
- The associated Sign Key ID.
- The
securityTokenIdandsecurityTokenValue.
Integrate eCom SDK
Integrating the eCom Android SDK consists of four steps:- Install the SDK
- Initialize the SDK
- Add Configuration Class
- Register for Payment Result
Step 1: Install the SDK
The first step consists of installing the SDK. To do so:- Following the credentials received from Nayax, create an
ecomsdk.propertiesfile in the root folder of your project and add the following lines: - Add the Maven repository to your
settings.gradle(orbuild.gradlefor older Gradle). - In your project-level
build.gradle.kts, add the following Maven configuration:
- Add the SDK dependency to your module-level
build.gradle.kts:
Step 2: Initialize the SDK
Initialize the SDK in your application, using theinitialize method.
Sign Key and IDNayax provides the
signId , signKey, securityTokenId and securityTokenValue values during your onboarding. Ensure you handle these values securely.Step 3: Add the Configuration Class
The configuration class defines the SDK’s essential properties. The following table provides a description of each available configuration option:| Parameter | Type | Description |
|---|---|---|
environment | NayaxEcomEnvironment | The target server environment. Possible values are .stable, or .production. |
signId | Int | The ID used for signing API requests. |
signKey | String | The key used for signing API requests. |
securityTokenId | Int | The security token ID used for merchant validation. |
securityTokenValue | String | The security token value used for merchant validation. |
enableLog | Bool | A flag to enable or disable SDK logging. Defaults to false. |
Step 4: Register for Payment Result
Prepare the SDK to handle payment transaction results. Add the following setup in yourMainActivity: