Skip to content
@pulgueta/wompi
Esc
navigateopen⌘Jpreview
On this page

Package exports

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

The package publishes ECMAScript modules (ESM) and CommonJS (CJS) with separate type declarations for each subpath. The three code entry points contain the clients, schemas, and server helpers. Import only the entry you need.

@pulgueta/wompi

The default entry exports the Payments and Payouts clients.

import { WompiClient, WompiPayoutsClient } from "@pulgueta/wompi";
  • WompiClient: calls the Payments API through the merchants, transactions, tokens, paymentSources, paymentLinks, and pse resources
  • WompiPayoutsClient: calls the separate Pagos a Terceros API for bank and BRE-B dispersion batches, transactions, banks, accounts, limits, reports, health, and sandbox recharges

@pulgueta/wompi/schemas

Everything derived from both API contracts: the Zod schemas, inferred types, the Result tuple, and error classes.

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

import type {
  // Inferred types — return shapes, input shapes, enums and the Result tuple.
  Result,
  Transaction,
  TransactionStatus,
  CreateTransactionInput,
  CreatePayoutInput,
  Payout,
  PayoutTransaction,
  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.

// 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 entry contains checkout signing, URL construction, and payment or payout webhook verification.

import {
  buildCheckoutUrl,
  getSignatureKey,
  isPayoutTransactionUpdatedEvent,
  isPayoutUpdatedEvent,
  isTransactionUpdatedEvent,
  verifyPayoutEvent,
  verifyWebhookEvent,
} from "@pulgueta/wompi/server";

Subpath summary

Subpath Exports Notes
. WompiClient, WompiPayoutsClient Clients for the Payments and Payouts APIs.
./schemas Zod schemas, inferred types, error classes, Result Validation layers, typing and instanceof branching.
./server Signing, checkout URL, and webhook helpers Web Crypto, server-only.
./package.json The manifest Exposed for tooling that reads the version.

Was this page helpful?