Payment Links
Payment Links — methods, parameters, and examples for @easylabs/node.
Payment links are hosted, no-code checkout pages — share a URL and Easy Labs handles collection, instrument capture, branding, and receipts. Use them for invoicing-as-a-link, donation pages, single-product sales, or multi-use storefronts.
Methods
createPaymentLink(payload)
POST /payment-link. Returns ApiResponse<{ id: string }> — fetch the full link with getPaymentLink if you need the URL.
// `products[].id` references a Product you've already created (see
// /resources/products-pricing). Each entry then lists one or more
// `product_prices` by Price ID, with the quantity to bill.
const { data } = await easy.createPaymentLink({
nickname: "Conference ticket",
amount_type: "FIXED",
products: [
{
id: "PROD_vip_pass",
product_prices: [{ id: "PR_vip_pass_25000", quantity: 1 }],
},
],
allowed_payment_methods: ["PAYMENT_CARD"],
payment_limit: 100,
collect_buyer_details: "more",
});
const link = await easy.getPaymentLink(data.id);
console.log(link.data.link_url);getPaymentLinks(params?)
GET /payment-link/. Standard pagination.
getPaymentLink(paymentLinkId)
GET /payment-link/:id.
updatePaymentLink(paymentLinkId, body)
PATCH /payment-link/:id. Accepts UpdatePaymentLinkPayload (all CreatePaymentLinkPayload fields are optional).
await easy.updatePaymentLink(linkId, { branding_overrides: { brand_color: "#0F172A" } });deletePaymentLink(paymentLinkId)
DELETE /payment-link/:id.
getPaymentLinkPayments(paymentLinkId, params?)
GET /payment-link/:id/payments. Returns the orders that closed against the link.
Object shape
PaymentLinkData carries the rendered hosted-page configuration plus runtime state: id, link_url, link_expires_at, state ("DRAFT" | "ACTIVE" | "INACTIVE" | "EXPIRED"), payment_count, payment_limit, payment_frequency ("ONE_TIME" | "RECURRING"), is_multiple_use, items[] (with price_details), amount_details (amount_type, totals, optional min/max for variable links), branding, branding_overrides, additional_details (collect_*, return URLs, expiration), buyer_details once the buyer has filled them in, and the standard tags bag.
Examples
Variable-amount donation link
// For a VARIABLE-amount link, omit the product `id` and pass an empty
// `product_prices` array — the buyer chooses the amount within
// `min_amount` / `max_amount`.
await easy.createPaymentLink({
nickname: "Donations",
amount_type: "VARIABLE",
products: [{ product_prices: [] }],
min_amount: 500,
max_amount: 100000,
payment_limit: null, // unlimited
});Single-use invoice replacement
// Pre-create a Product + Price for "Invoice #2024-117" via createProduct /
// createPrice, then reference the resulting IDs here.
const link = await easy.createPaymentLink({
amount_type: "FIXED",
products: [
{
id: "PROD_invoice_2024_117",
product_prices: [{ id: "PR_invoice_2024_117", quantity: 1 }],
},
],
payment_limit: 1,
collect_buyer_details: "more",
});Reconcile payments for a link
const orders = await easy.getPaymentLinkPayments(linkId, { limit: 100 });
for (const o of orders.data) {
console.log(o.order_number, o.total_cents, o.identity?.entity.email);
}