Easy Labs
SDKsNode.jsResources

Coupons

Coupons — methods, parameters, and examples for @easylabs/node.

A coupon is a reusable discount template — percentage-off or fixed-amount, applied once / for N months / forever. Coupons are attached to subscriptions via applySubscriptionDiscount or surfaced to buyers through promotion codes.

Methods

easy.createCoupon(body);          // POST   /coupons
easy.listCoupons(params?);        // GET    /coupons
easy.getCoupon(couponId);         // GET    /coupons/:id
easy.updateCoupon(couponId, body); // PATCH  /coupons/:id
easy.deleteCoupon(couponId);      // DELETE /coupons/:id

CreateCoupon is a discriminated union — pass percent_off or amount_off + currency, never both:

// Percentage off
await easy.createCoupon({
  duration: "repeating",
  duration_in_months: 3,
  percent_off: 25,
  name: "Q2 promo",
  max_redemptions: 1000,
  valid_until: "2026-06-30T23:59:59Z",
  applies_to_products: ["PD_pro"],
  metadata: { campaign: "spring_2026" },
});

// Fixed amount off (smallest currency unit)
await easy.createCoupon({
  duration: "once",
  amount_off: 1000,
  currency: "USD",
  name: "$10 welcome credit",
});

UpdateCoupon is intentionally narrow — only name, active, and metadata are mutable. To change the discount itself, create a new coupon and migrate users.

Object shape

CouponData:

FieldTypeNotes
idstring
namestring | null
duration"once" | "repeating" | "forever"
duration_in_monthsnumber | nullOnly set when duration === "repeating".
percent_offnumber | null0–100.
amount_offnumber | nullSmallest currency unit.
currencystring | nullRequired with amount_off.
max_redemptionsnumber | nullLifetime cap.
times_redeemednumberCounter.
valid_untilstring | nullISO timestamp.
applies_to_productsstring[] | nullRestrict eligibility.
activeboolean
metadataRecord<string, unknown>

Examples

Forever 50%-off VIP coupon

const coupon = await easy.createCoupon({
  duration: "forever",
  percent_off: 50,
  name: "VIP",
});

Pause a coupon without deleting redemptions

await easy.updateCoupon(couponId, { active: false });

List active coupons

const all = await easy.listCoupons({ limit: 100 });
const active = all.data.filter((c) => c.active);

On this page