@pulgueta/wompi

API Reference

Payment links

Hosted checkout links — create one, share the URL, get notified on success.

Payment links are the fastest way to take a Wompi payment without integrating the full checkout. The SDK creates the link record; Wompi serves the checkout UI at https://checkout.wompi.co/l/{id}.

Authentication

MethodHTTPAuth
getPaymentLinkGET /payment_links/{id}None
createPaymentLinkPOST /payment_linksPrivate key
updatePaymentLinkPATCH /payment_links/{id}Private key

createPaymentLink(input)

Create a hosted checkout link with a fixed amount.

ts
const [error, response] = await wompi.paymentLinks.createPaymentLink({
  name: "Order #1024",
  description: "Thank you for shopping.",
  single_use: true,
  collect_shipping: false,
  amount_in_cents: 99_000,
  currency: "COP",
});
if (error) throw error;

const link = response;
const checkoutUrl = `https://checkout.wompi.co/l/${link.id}`;

Input fields

FieldTypeNotes
namestringShown on the checkout page.
descriptionstringSub-line on the checkout page.
single_usebooleanIf true, the link burns after first paid transaction.
collect_shippingbooleanShow a shipping address form.
collect_customer_legal_idboolean?Ask for the customer's legal id.
amount_in_centsinteger?Omit for open-amount links.
currency"COP"?Inferred from the merchant.
referencestring?Your merchant reference.
signaturestring?Optional — Wompi can compute it.
skustring?Max 36 chars.
expires_at / expiration_timestring?ISO-8601 expiry timestamps.
redirect_urlstring?Where to send the customer after payment.
image_urlstring?Product image displayed on checkout.
customer_dataobject?Up to 2 extra references — e.g. order id, table number.
taxesarray?VAT / CONSUMPTION; per-amount or per-percentage.

Open-amount links

Drop amount_in_cents to let the customer enter the amount at checkout.

ts
// Omit amount_in_cents for "donation" / open-amount links — the customer
// fills in the amount at checkout.
const [error, response] = await wompi.paymentLinks.createPaymentLink({
  name: "Tip jar",
  description: "Pay what you want",
  single_use: false,
  collect_shipping: false,
});

Taxes

Each tax entry is either amount_in_cents or percentage-shaped.

ts
// Add VAT and a consumption tax to the link.
const [error, response] = await wompi.paymentLinks.createPaymentLink({
  name: "Restaurant tab",
  description: "Dinner for two",
  single_use: true,
  collect_shipping: false,
  amount_in_cents: 150_000,
  taxes: [
    { type: "VAT", amount_in_cents: 24_000 },
    { type: "CONSUMPTION", percentage: 8 },
  ],
});

getPaymentLink(id)

Fetch a link by id — public endpoint, no auth header. Useful for status pages that link to a checkout.

ts
const [error, response] = await wompi.paymentLinks.getPaymentLink(linkId);
if (error) {
  if ("type" in error && error.type === "NOT_FOUND_ERROR") return null;
  throw error;
}

response.active;        // boolean — has it been deactivated?
response.amount_in_cents;
response.single_use;

updatePaymentLink(id, input)

The update endpoint only flips the active flag — there is no way to mutate other fields of an existing link. Create a new link if the amount or description changes.

ts
// Deactivate a link so the URL stops accepting payments.
const [error] = await wompi.paymentLinks.updatePaymentLink(linkId, { active: false });

// Re-activate the same link later.
const [error] = await wompi.paymentLinks.updatePaymentLink(linkId, { active: true });
Navigation