Pular para o conteúdo

Web SDK overview

@lina-openx/web-lina-pay-sdk is a browser-side TypeScript SDK that wraps the Lina Pay Open Finance APIs behind small, typed, tree-shakeable functions. Unlike the Server SDK — which runs on your backend and signs every call with client_credentials — this package is meant to be called from front-end code (a web app, a checkout page, an admin portal) and also ships the browser-side FIDO2/WebAuthn ceremony needed for device-enrolled payments.

What it covers

  • Payment consent & payment requests — open a consent, create a payment request, query and cancel it.
  • Automatic & recurring payments — create and query recurring payment requests, cancel a single installment, or revoke the whole recurring consent.
  • Enrollments (device linking) & FIDO2 payments — register a payer's device with a passkey and pay afterwards without a bank redirect.
  • Receiving accounts & bank identifiers — manage the sub-tenant's payout accounts and look up ISPB codes.
  • Linked Journey — a single call that creates a Data Link consent and an enrollment together.
  • Payments view — paginated, filterable listing of payments by tenant or sub-tenant.

See Payments, Automatic & recurring payments, Enrollments & FIDO2 payments, Receiving accounts, Linked Journey, and Payments view for the full method reference.

Install

npm install @lina-openx/web-lina-pay-sdk

Configure the environment

The SDK ships pointed at the homologation (HML) environment by default. Call configure once, at startup, to point it at production instead:

import { configure } from '@lina-openx/web-lina-pay-sdk'

// Production
configure({
iamBaseUrl: 'https://iam.linaob.com.br',
apiBaseUrl: 'https://embedded-payment-manager.linaob.com.br',
})

// Homologation (default — shown for reference)
configure({
iamBaseUrl: 'https://iam.hml.linaob.com.br',
apiBaseUrl: 'https://embedded-payment-manager.hml.linaob.com.br',
})

Imports at a glance

Most functions are top-level named exports. Four feature areas are grouped under a namespace instead, because they don't have an individual export:

import {
configure,
createConsent,
createPaymentRequest,
getPaymentRequest,
cancelPaymentRequest,
cancelPayment,
listAllPaymentRequests,
createPayment,
createEnrollment,
getEnrollmentList,
revokeEnrollment,
registerDevice,
createPaymentWithEnrollment,
getParticipants,
createAutomaticPaymentRequest,
getAutomaticPaymentRequest,
createReceivingAccount,
listReceivingAccounts,
getReceivingAccount,
updateReceivingAccount,
deleteReceivingAccount,
getBankIdentifiers,
getBankIdentifier,
linkedJourney,       // namespace: .createOptimizedBinding / .getConsentById / .getAccountsByUserId
automaticPayments,   // namespace: .cancelAutomaticPayment / .cancelAutomaticPaymentRequest
paymentsView,        // namespace: .getAllPaymentsByTenants / .getAllPaymentsBySubtenant
LinaPayError,
} from '@lina-openx/web-lina-pay-sdk'

Next steps