@pulgueta/wompi

Reference

Package exports

Every entry point @pulgueta/wompi ships and what's behind it.

The package is published as ESM and CJS with separate type declarations for each subpath. There are three: the client, the schemas (with their types and error classes) and the server helper. Pull in only the entry you need — the others stay out of your bundle.

@pulgueta/wompi

The default entry. Exports the client — the one class you construct to call the API.

ts
import { WompiClient } from "@pulgueta/wompi";
  • WompiClient — the high-level client used in every other doc page. It owns the merchants, transactions, tokens, paymentSources, paymentLinks and pse sub-resources.

@pulgueta/wompi/schemas

Everything derived from the API contract: the Zod schemas, the types inferred from them (return shapes, input shapes, enums, the Result tuple) and the four error classes.

ts
import {
  // Zod schemas — validate a request body before it reaches the SDK.
  CreateTransactionInputSchema,
  TokenizeCardInputSchema,
  CreatePaymentLinkInputSchema,
  // Error classes — for instanceof branching.
  WompiError,
  WompiNotFoundError,
  WompiValidationError,
  WompiRequestError,
} from "@pulgueta/wompi/schemas";

import type {
  // Inferred types — return shapes, input shapes, enums and the Result tuple.
  Result,
  Transaction,
  TransactionStatus,
  CreateTransactionInput,
  PaymentLink,
  PaymentSource,
  CardToken,
  Merchant,
  FinancialInstitution,
} from "@pulgueta/wompi/schemas";

Pair the schemas with your own routing layer to validate request bodies before they hit the SDK.

ts
// Validate an incoming form body before passing it to the SDK.
const parsed = CreateTransactionInputSchema.safeParse(req.body);
if (!parsed.success) return res.status(400).json(parsed.error.flatten());

The error classes (WompiError and its subclasses) live here too. See Error handling for when each one is returned.

@pulgueta/wompi/server

The server-only helper: getSignatureKey, the integrity signature builder. Kept in its own entry so the client bundle stays free of the signing code.

ts
import { getSignatureKey } from "@pulgueta/wompi/server";

Subpath summary

SubpathExportsNotes
.WompiClientThe client. The only entry most apps import.
./schemasZod schemas, inferred types, error classes, ResultValidation layers, typing and instanceof branching.
./servergetSignatureKeyWeb Crypto, server-only.
./package.jsonThe manifestExposed for tooling that reads the version.
Navigation