Install & initialize
Add the package for your language, then create a single
LinaEmbeddedPaymentsClient and reuse it across requests — the client caches
the access token internally, so one instance per process is enough.
Install the package
npm install @linainfratech/embedded-payments<!-- Maven -->
<dependency>
<groupId>com.linainfratech</groupId>
<artifactId>embedded-payments-sdk</artifactId>
<version>0.1.0</version>
</dependency>// Package.swift
dependencies: [
.package(url: "https://.../lina-embedded-payments-sdk-swift.git", from: "0.1.0"),
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "LinaEmbeddedPayments", package: "lina-embedded-payments-sdk-swift"),
]),
]dotnet add package LinaInfratech.EmbeddedPaymentsInitialize the client
The recommended way to configure the client is environment: 'hml' | 'prd'
— the SDK resolves everything else internally, including authentication.
Provide your integrator credentials (clientId/clientSecret) and the
client fetches, caches, and refreshes the access token for you; you never
talk to an auth endpoint directly.
import { LinaEmbeddedPaymentsClient } from '@linainfratech/embedded-payments';
const client = new LinaEmbeddedPaymentsClient({
environment: 'hml', // 'hml' | 'prd' — resolves baseUrl/authBaseUrl for you
clientId: process.env.LINA_CLIENT_ID,
clientSecret: process.env.LINA_CLIENT_SECRET,
// Optional: subTenantId, timeoutMs, maxRetries, logger, fetch, tokenProvider
// Advanced override: baseUrl / authBaseUrl (proxy, mTLS, custom infra)
});
const participants = await client.participants.listRegistered();import com.linainfratech.embeddedpayments.*;
import com.linainfratech.embeddedpayments.model.*;
var client = new LinaEmbeddedPaymentsClient(
ClientConfig.builder()
.environment(ClientConfig.Environment.HML) // HML | PRD
.clientId(System.getenv("LINA_CLIENT_ID"))
.clientSecret(System.getenv("LINA_CLIENT_SECRET"))
.build());
List<Participant> banks = client.participants.listRegistered();import LinaEmbeddedPayments
let client = try LinaEmbeddedPaymentsClient(config: ClientConfig(
environment: .hml, // .hml | .prd
clientId: ProcessInfo.processInfo.environment["LINA_CLIENT_ID"],
clientSecret: ProcessInfo.processInfo.environment["LINA_CLIENT_SECRET"]))
let participants = try await client.participants.listRegistered()using LinaInfratech.EmbeddedPayments;
var client = new LinaEmbeddedPaymentsClient(new ClientOptions
{
Environment = LinaEnvironment.Hml, // Hml | Prd
ClientId = Environment.GetEnvironmentVariable("LINA_CLIENT_ID"),
ClientSecret = Environment.GetEnvironmentVariable("LINA_CLIENT_SECRET"),
});
var participants = await client.Participants.ListRegisteredAsync();
// Or register it for dependency injection (singleton):
services.AddLinaEmbeddedPayments(options =>
{
options.Environment = LinaEnvironment.Hml;
options.ClientId = "...";
options.ClientSecret = "...";
});Configuration options
The same options exist in every language, with idiomatic names
(timeoutMs in Node, timeout/Timeout elsewhere; clientId/ClientId).
| Option | Required | Default | Description |
|---|---|---|---|
environment | No¹ | — | 'hml' | 'prd' — the recommended way to configure the client. |
baseUrl / authBaseUrl | No¹ | — | Advanced override for a proxy, mTLS terminator, or custom infra. Not needed if environment is set — most integrations never touch these. |
clientId / clientSecret | Yes² | — | Your integrator credentials — identify your sub-tenant. Provided when you're onboarded. |
subTenantId | No | — | Admin/tenant callers only; sent as the subTenantId header. |
timeout | No | 30000 ms | Per-request timeout. |
maxRetries | No | 2 | Retries on idempotent (GET) calls only. |
logger | No | no-op | Structured log hook (debug/info/warn/error). |
tokenProvider | No | client_credentials | Plug in your own token strategy. |
| HTTP client | No | native | Inject a custom HTTP client for mTLS, proxy, or tests (fetch in Node, HttpExecutor in .NET). |
¹ Provide environment, or baseUrl+authBaseUrl, or both (explicit values override the environment
default per field). Providing neither raises a config error at construction time.
² clientId and clientSecret are required only with the default token strategy. With a custom
tokenProvider, the SDK never fetches a token itself and they can be omitted.
Authentication
Authentication is automatic and entirely handled for you: provide
clientId/clientSecret, and the SDK fetches, caches, and refreshes the
access token behind the scenes — refreshing proactively before it's within
300 seconds of expiry, and sharing a single in-flight refresh across
concurrent calls. You never call an auth endpoint or manage a token
yourself.
Environments
environment: 'hml' targets the homologation/sandbox infrastructure;
environment: 'prd' targets production. Credentials are the only thing that
changes between them — paths and payloads are identical, so code written
against hml works unchanged in prd.
Next steps
- Link an account — the enrollment flow every payment depends on.
- Pay a QR Code — pay a boleto or Pix QR Code.
- Error handling — catch and classify failures.