KwitKwit Docs

Discounts API

Create, retrieve, and validate discount codes

llms.txtCreate, retrieve, and validate discount codes

Create discount

POST /v1/discounts

Body (createDiscountSchema): name, type (PERCENTAGE | FIXED), value, duration (ONCE, REPEATING, FOREVER), optional code, durationInMonths, maxRedemptions, startsAt, endsAt, productIds, active, metadata.

Response 201.

Get discount

GET /v1/discounts/:id

Response 200 or 404.

Validate code

POST /v1/discounts/validate

Body (resolveDiscountCodeSchema):

FieldTypeRequired
codestringYes
productIdstringNo

Response 200 - discount if valid. Response 404 - { "error": "Discount not found" }.

const discount = await kwit.discounts.validate({
  code: "LAUNCH20",
  productId: product.id,
});

On this page