Authorization
Example:
Authorization | Bearer Paste-Your-API-Key-HereRequest Body
Discount name (minimum 5 characters).
Discount coupon expiration date. When omitted, the discount and its coupon do
not expire (
expiredAt is stored as null).Details of the discount conditions.
Coupon code details.
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)
Discount type:
- monetary
- percentage
percentage, a value greater than 99 is automatically capped at 99.Target customers who can use the discount coupon:
- all
- new
- old
Minimum purchase amount required to use the discount.
Discount amount (must be positive).
Available coupon quota (must be positive). For
onetime coupons, a maximum of
50 codes are generated per request.coupon Structure (Object)
Discount coupon code. Optional — when omitted, a random code is generated. Only
used for
reusable coupons; onetime coupons always receive generated codes.Coupon type:
- reusable
- onetime
products Structure (Array Of Object)
Product (payment link) ID to attach the discount to.
Response
Successful ResponseMain Structure (Root)
Status code from API.
Status message that describes the status code.
The created discount details.
data Structure (Object)
Discount ID.
Discount name.
Discount type.
Discount value.
Minimum purchase amount to apply the discount.
null if not set.Eligible customer scope.
Total number of coupons available.
Discount product scope:
all when no products are attached, selected when one
or more products are provided.Expiration date in ISO 8601 format, or
null when the discount does not expire.Indicates if the discount is lifetime (
true/false) or null.Discount status (example:
"active").List of coupons created for this discount.
List of products attached to the discount (empty when applied to all products).
Creation time in ISO 8601 format.
coupons Structure (Array Of Object)
Coupon ID. Present for
reusable coupons; omitted for onetime coupons.Coupon code.
Coupon type (
reusable or onetime).Coupon expiration date, or
null when it does not expire.products Structure (Array Of Object)
Attached product (payment link) ID.
Errors
Returned with
messages: "Validation Error" when the request body fails
validation (e.g. missing or malformed name, discount, or coupon fields).Returned with
messages: "Product Tidak Bisa Ditambahkan" when an attached
product is not owned by the authenticated account.Returned with
messages: "Product Tidak Ditemukan" when an attached product
cannot be found.Returned with
messages: "Coupon code already in use" when a reusable coupon
code already exists.