Getnet DocsGetnet Docs

JavaScript Library Integration

Integrate the Integrated POS into your application using our JavaScript library.

Supported environments

Use the pos-integrated-lib-javascript library across server-side and client-side implementations:

  • ESM (ECMAScript Modules)
  • CommonJS
  • Browser environments

Installation

The package is private and is not published to the public npm registry. Install it from the local .tgz file provided by Getnet:

npm install ./lib/pos-integrated-lib-javascript-<VERSION>.tgz

Workflow and lifecycle

Follow the strict connection lifecycle pattern to ensure robust terminal communication.

Connection establishment

Create a connector using one of the factory methods (CreateHttp, CreateUsb, or CreateCloud). Creation is synchronous — it returns the Connector directly, not a Promise. Await the async operational methods like SaleAsync or GetInfoAsync. Use CreateCloud to reach a remote terminal through the Getnet cloud, with no hostname or port.

import { Connector } from 'pos-integrated-lib-javascript';

async function processPayment() {
    // Initialize the connector (synchronous — no await)
    const connector = Connector.CreateHttp('192.168.1.100', 8080);
    
    // Execute a sale or other operations...
}

Connector closure (mandatory)

Close the connector immediately after your operations finish or when the application lifecycle ends. Releasing the connector frees up the POS terminal resources, ensuring subsequent connection attempts succeed.

// ...after operations complete
await connector.Close();

Failing to call Close() leaks connection states on the POS device, causing a “Terminal Busy” block for future requests.

Next steps