Coupons
Get all coupons
GET
https://plugin.tebex.io/coupons
Return a paginated list of coupons on your account.
Headers
X-Tebex-Secret
string
The secret key of a server.
{
"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 a coupon
GET
https://plugin.tebex.io/coupons/{id}
Get a coupon by ID.
Path Parameters
id
string
The coupon ID.
Headers
X-Tebex-Secret
string
The secret key of a server.
{
"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"
}
}
Create a coupon
POST
https://plugin.tebex.io/coupons
Create a coupon code.
Headers
X-Tebex-Secret
string
The secret key of a server.
Request Body
code
string
The code of the coupon.
effective_on
string
What this coupon should be effective on, either "package", "category" or "cart".
packages
array
An array of package IDs this coupon should apply to. Only used if effective_on is "package".
categories
array
An array of category IDs this coupon should apply to. Only used if effective_on is "category".
discount_type
string
"percentage" or "value".
discount_amount
integer
The currency amount to discount.
discount_percentage
integer
The percentage amount to be discounted.
redeem_unlimited
boolean
Can the coupon be redeemed an unlimited amount of times.
expire_never
boolean
Should the coupon ignore the expire_date.
expire_limit
number
Only used if redeem_unlimited is false.
expire_date
string
Only used if expire_never
is false
- formatted in yyyy-mm-dd.
start_date
string
The start date of the coupon in the format of yyyy-mm-dd.
basket_type
string
"single", "subscription", or "both".
minimum
number
Minimum value of basket before the coupon can be redeemed.
discount_application_method
number
0 = Apply to each package (default), 1 = Apply to basket (before sales), 2 = Apply to basket (after sales)
username
string
The username to restrict the coupon to.
note
string
The note to store against the coupon.
{
"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 a coupon
DELETE
https://plugin.tebex.io/coupons/{id}
Delete a coupon.
Path Parameters
id
string
The ID of the coupon.
Headers
X-Tebex-Secret
string
The secret key of a server.
Last updated
Was this helpful?