Liqo

API Reference

Every method, param, and return type

Complete reference for the @liqo/sdk public surface. Everything here is exported from @liqo/sdk and verified against the Liqo platform contract.

new Liqo(apiKey, options?)

const liqo = new Liqo(apiKey: string, options?: LiqoOptions);

Throws LiqoSdkError if apiKey is empty.

LiqoOptions

OptionTypeDefaultDescription
environment'sandbox' | 'production''sandbox'Selects default base URLs
baseUrlstringenv-basedOverride API base URL
checkoutBaseUrlstringhttps://checkout.liqo.networkOverride checkout base URL
timeoutMsnumber15000Per-request timeout (timeout is an alias)
retryAttemptsnumber3Retries on network errors / 429
webhookSecretstringEnables webhooks.verify()
debugbooleanfalseLogs requests/responses
polling{ intervalMs?: number; timeoutMs?: number }2000 / 60000Defaults for waitForCompletion

Read-only properties

liqo.environment, liqo.baseUrl, liqo.checkoutBaseUrl, liqo.debug.


Payments

liqo.pay(params: PayParams): Promise<PayResponse>

POST/checkout/sessions

Creates a payment via hosted checkout. See Payments.

PayParams: amount, fromCurrency, toAsset, toWallet, payerEmail, successUrl, cancelUrl, optional targetChain, method, sourceCountry, expiresInMinutes, metadata, idempotencyKey.

PayResponse = CheckoutSessionCreateResponse = { checkoutUrl: string; session: PublicCheckoutSession }.


Checkout

liqo.checkout.sessions.create(params): Promise<CheckoutSessionCreateResponse>

POST/checkout/sessions

params is CreateCheckoutSessionRequest & { idempotencyKey?: string }.

liqo.checkout.sessions.retrieve(token): Promise<PublicCheckoutSession>

GET/checkout/sessions/:token

See Checkout for field shapes and statuses.


Quotes

liqo.quote(params: QuoteParams): Promise<QuoteResponse>

GET/quote

Read-only.

QuoteParams: amount, fromCurrency, toAsset, optional targetChain.

QuoteResponse: { fromCurrency, toAsset, inputAmount, estimatedOutput, fee, expiresAt, type?, estimatedTimeMs? }.


Transactions

liqo.transactions.retrieve(id): Promise<TransactionResponse>

liqo.getTransaction(id): Promise<TransactionResponse>

GET/transaction/:id

getTransaction is an alias.

liqo.waitForCompletion(id, options?): Promise<TransactionResponse>

Polls GET /transaction/:id until a terminal status or timeout. options: { intervalMs?, timeoutMs? }. Throws LiqoSdkError on timeout.

See Transactions.


Webhooks

liqo.webhooks.verify(params): VerifiedLiqoWebhookEvent

Verifies a signed webhook. params: { payload: string | Buffer; headers; secret?; toleranceSeconds? }. Throws LiqoSdkError if invalid. See Webhooks.


Events

liqo.on(event, handler): () => void

Subscribe to 'request' | 'response' | 'error'. Returns an unsubscribe function.

const off = liqo.on('response', ({ method, path, attempt }) => { /* … */ });
off();

Helpers & Errors

ExportDescription
isTerminalStatus(status): booleanWhether a status is terminal (completed/failed)
LiqoApiErrorThrown for API error responses
LiqoSdkErrorThrown for client-side errors (subclass of LiqoApiError)

Exported types

LiqoOptions, PayParams, PayResponse, CheckoutSessionCreateParams, CheckoutSessionCreateResponse, QuoteParams, QuoteResponse, TransactionResponse, WebhookVerifyParams, VerifiedWebhookEvent, VerifiedLiqoWebhookEvent.


Deprecated / unsupported

MemberStatus
verifyWebhook(signature, payload)Deprecated — throws; use webhooks.verify
payAndWait(params, opts)Unsupported for checkout — throws
payAndConfirm(params, opts)Unsupported for checkout — throws

On this page