Pre-requisites
To ensure compatibility and optimal performance, your Android project must meet the following minimum requirements:- ES2017+ JavaScript support required.
- TypeScript: 4.5+ (optional, but recommended for type safety and better IDE support).
- ES2017 features (async/await, Object.entries, Object.values, etc.).
- DOM and Web APIs (localStorage, fetch).
- The bundled dependencies use modern JavaScript features.
- ES Modules (ESM): For modern bundlers (Webpack, Vite, Rollup)
- CommonJS (CJS): For Node.js and older bundlers
- UMD: For direct browser usage via
<script>tag
Integrate eCom SDK
Integrating the eCom Web SDK consists of four steps:- Install the SDK
- Initialize the SDK
- Add Configuration Class
Step 1: Install the SDK
The NayaxEcomSDK is hosted on Nayax’s private GitLab package registry. You’ll need to configure access before installation.- The Nayax eCOM Team will provide you with a read-only access token. Create or update your
.npmrcfile in your project root:
Shell
- To install the SDK, use the following command:
For UMD builds or alternative distribution methods, contact the Nayax Ecom Team.
Step 2: Initialize the SDK
To use the eCOM Web SDK, you have to initialize the SDK instance:- The Web SDK uses a constructor-based pattern (non-singleton). Create a new instance with your configuration:
The
signId, signKey, securityTokenId, and securityTokenValue values will be provided by the Nayax eCOM Team. Ensure you handle these values securely.- The
NayaxEcomConfiginterface encapsulates the essential properties for SDK configuration:
Step 3: Configure the SDK
To configure the eCOM web SDK, follow these steps:- Import the SDK (ES modules):
- Import the SDK (CommonJS)
The SDK automatically includes all required CSS styles (including Drop-in styles) bundled within the JavaScript. No separate CSS imports are needed
Environment Configuration
The SDK supports four environments:| Environment | Description | Use Case |
|---|---|---|
develop | Development environment. | Internal development and testing. |
qa | Quality Assurance environment. | QA testing and integration testing. |
stable | Staging environment | Pre-production testing. |
production | Production environment. | Live transactions. |