Skip to main content
Endpoint:

Authorization

string
required
Example:Authorization | Bearer Paste-Your-API-Key-Here

Request Body

string
required
Discount name (minimum 5 characters).
string | datetime
Discount coupon expiration date. When omitted, the discount and its coupon do not expire (expiredAt is stored as null).
object
required
Details of the discount conditions.
object
required
Coupon code details.
array of object
List of eligible products (maximum 2). Leave empty to apply the discount to all products. When provided, each item requires a product id you own.

discount Structure (Object)

string
required
Discount type:
  • monetary
  • percentage
For percentage, a value greater than 99 is automatically capped at 99.
string
required
Target customers who can use the discount coupon:
  • all
  • new
  • old
number | integer
Minimum purchase amount required to use the discount.
number | integer
required
Discount amount (must be positive).
number | integer
required
Available coupon quota (must be positive). For onetime coupons, a maximum of 50 codes are generated per request.

coupon Structure (Object)

string
Discount coupon code. Optional — when omitted, a random code is generated. Only used for reusable coupons; onetime coupons always receive generated codes.
string
required
Coupon type:
  • reusable
  • onetime

products Structure (Array Of Object)

string
required
Product (payment link) ID to attach the discount to.

Response

Successful Response

Main Structure (Root)

integer
Status code from API.
string
Status message that describes the status code.
object
The created discount details.

data Structure (Object)

string<uuid>
Discount ID.
string
Discount name.
string
Discount type.
number
Discount value.
number | null
Minimum purchase amount to apply the discount. null if not set.
string
Eligible customer scope.
integer
Total number of coupons available.
string
Discount product scope: all when no products are attached, selected when one or more products are provided.
string (ISO 8601) | null
Expiration date in ISO 8601 format, or null when the discount does not expire.
boolean | null
Indicates if the discount is lifetime (true/false) or null.
string
Discount status (example: "active").
array of object
List of coupons created for this discount.
array of object
List of products attached to the discount (empty when applied to all products).
string (ISO 8601)
Creation time in ISO 8601 format.

coupons Structure (Array Of Object)

string<uuid>
Coupon ID. Present for reusable coupons; omitted for onetime coupons.
string
Coupon code.
string
Coupon type (reusable or onetime).
string (ISO 8601) | null
Coupon expiration date, or null when it does not expire.

products Structure (Array Of Object)

string<uuid>
Attached product (payment link) ID.

Errors

object
Returned with messages: "Validation Error" when the request body fails validation (e.g. missing or malformed name, discount, or coupon fields).
object
Returned with messages: "Product Tidak Bisa Ditambahkan" when an attached product is not owned by the authenticated account.
object
Returned with messages: "Product Tidak Ditemukan" when an attached product cannot be found.
object
Returned with messages: "Coupon code already in use" when a reusable coupon code already exists.