Coupons

get
Get all coupons

https://plugin.tebex.io/coupons
Return a paginated list of coupons on your account.
Request
Response
Headers
X-Tebex-Secret
required
string
The secret key of a server.
200: OK
{
"pagination": {
"totalResults": 157,
"currentPage": 1,
"lastPage": 7,
"previous": null,
"next": "https://plugin.tebex.io/coupons?page=2"
},
"data": [
{
"id": 2,
"code": "mycode-123",
"effective": {
"type": "cart",
"packages": [],
"categories": []
},
"discount": {
"type": "value",
"percentage": 0,
"value": 2
},
"expire": {
"redeem_unlimited": "false",
"expire_never": "true",
"limit": 0,
"date": "1901-12-13T20:45:52+0000"
},
"basket_type": "single",
"start_date": "2017-01-01T00:00:00+0000",
"user_limit": 1,
"minimum": 5,
"username": "Notch",
"note": "Coupon note"
}
]
}

get
Get a coupon

https://plugin.tebex.io/coupons/{id}
Get a coupon by ID.
Request
Response
Path Parameters
id
required
string
The coupon ID.
Headers
X-Tebex-Secret
required
string
The secret key of a server.
200: OK
{
"data": {
"id": 2,
"code": "mycode-123",
"effective": {
"type": "cart",
"packages": [],
"categories": []
},
"discount": {
"type": "value",
"percentage": 0,
"value": 2
},
"expire": {
"redeem_unlimited": "true",
"expire_never": "true",
"limit": 0,
"date": "1901-12-13T20:45:52+0000"
},
"basket_type": "single",
"start_date": "2017-01-01T00:00:00+0000",
"user_limit": 1,
"minimum": 5,
"username": "",
"note": "Coupon note"
}
}

post
Create a coupon

https://plugin.tebex.io/coupons
Create a coupon code.
Request
Response
Headers
X-Tebex-Secret
required
string
The secret key of a server.
Body Parameters
code
required
string
The code of the coupon.
effective_on
required
string
What this coupon should be effective on, either "package" or "category".
packages
required
array
An array of package IDs this coupon should apply to. Only used if effective_on is "package".
categories
required
array
An array of category IDs this coupon should apply to. Only used if effective_on is "category".
discount_type
required
string
"percentage" or "value".
discount_amount
required
integer
The currency amount to discount.
discount_percentage
required
integer
The percentage amount to be discounted.
redeem_unlimited
required
boolean
Can the coupon be redeemed an unlimited amount of times.
expire_never
required
boolean
Should the coupon ignore the expire_date.
expire_limit
optional
number
Only used if redeem_unlimited is true.
expire_date
optional
string
Only used if expire_never is true - formatted in yyyy-mm-dd.
start_date
required
string
The start date of the coupon in the format of yyyy-mm-dd.
basket_type
required
string
"single", "subscription", or "both".
minimum
required
number
Minimum value of basket before the coupon can be redeemed.
discount_application_method
required
number
0 = Apply to each package (default), 1 = Apply to basket (before sales), 2 = Apply to basket (after sales)
username
optional
string
The username to restrict the coupon to.
note
required
string
The note to store against the coupon.
200: OK
{
"data": {
"id": 3,
"code": "mycode-123",
"effective": {
"type": "cart",
"packages": [],
"categories": []
},
"discount": {
"type": "value",
"percentage": 0,
"value": 2
},
"expire": {
"redeem_unlimited": "false",
"expire_never": "true",
"limit": 0,
"date": "-0001-11-30T00:00:00+0000"
},
"basket_type": "single",
"start_date": "2017-01-01T00:00:00+0000",
"user_limit": 1,
"minimum": 5,
"discount_application_method" : 0,
"username": "Notch",
"note": "Coupon note"
}
}

delete
Delete a coupon

https://plugin.tebex.io/coupons/{id}
Delete a coupon.
Request
Response
Path Parameters
id
required
string
The ID of the coupon.
Headers
X-Tebex-Secret
required
string
The secret key of a server.
204: No Content
‚Äč