Pular para o conteúdo

Linked Journey

The Linked Journey (jornada otimizada) collapses account-linking into a single call: one request opens a Data Link consent and an enrollment together, instead of creating them separately. The three functions below only exist on the linkedJourney namespace — there is no individual export.

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

Create an optimized binding

Takes the same payload shape as createEnrollment (minus riskSignals, which the SDK collects and attaches automatically):

const binding = await linkedJourney.createOptimizedBinding(credentials, {
organisationId: 'org-uuid',
authorisationServerId: 'auth-uuid',
enrollment: {
  document: '12345678901',
  deviceName: "Jane's iPhone",
  debtor: {
    accountNumber: '123456',
    accountIssuer: '0001',
    accountIspb: '12345678',
    accountType: 'CACC',
  },
},
redirectUri: 'https://example.com/linked-journey-callback',
})

console.log(binding.id, binding.consentId, binding.redirectUrl)
const consent = await linkedJourney.getConsentById(credentials, binding.consentId)

consentId may be a URN — it is URL-encoded internally.

List accounts linked to a user

const accounts = await linkedJourney.getAccountsByUserId(credentials, '12345678901')

accounts.forEach((a) => console.log(a.accountId, a.balance))

Next steps