Storeden Developers

Coupons API

Current version: v1.1 beta

List all coupons

GET
/coupons/list.json
List all coupons Request

$storeden = new Storeden\Storeden($config);
$coupons_list = $storeden->get('/coupons/list.json');
					
List all coupons Response

[
	{
		"uid": 49076,
		"code": "sYjvNtEqej7UyollX7Fv",
		"name": "Win from Guess a Number",
		"type": "1",
		"value": "50",
		"min_sum": 0,
		"stopDate": {
			"sec": 4132249199,
			"usec": 0
		},
		"active": 1,
		"unlimited": false,
		"count": 10,
		"startDate": {
			"sec": 1532383200,
			"usec": 0
		},
		"coupon_id": "525e8672be85f1ba37000003",
		"iso": {
			"startDate": "2018-07-24T00:00:00+0200",
			"stopDate": "2100-12-11T23:59:59+0100"
		}
	}
...
]
					

Get coupon details

Fetch single coupon details from coupon uid

GET
/coupons/coupon.json?uid={coupon-uid}
uid required (int) Unique uid of coupon
Get coupon details Request

$storeden = new Storeden\Storeden($config);
$coupon_data = $storeden->get('/coupons/coupon.json?uid=49076');
					
Get coupon details Response

{
    "uid": 49076,
    "code": "sYjvNtEqej7UyollX7Fv",
    "name": "Win from Guess a Number",
    "type": "1",
    "value": "50",
    "min_sum": 0,
    "stopDate": {
        "sec": 4132249199,
        "usec": 0
    },
    "active": 1,
    "unlimited": false,
    "count": 10,
    "startDate": {
        "sec": 1532383200,
        "usec": 0
    },
    "rules": {
        "remove_shipping_country": "",
        "remove_shipping_state": "",
        "remove_shipping_ship": "",
        "brand": "NULL",
        "customattribute": {
            "583ff96d16f46a5b3bd6c44c": "",
            "58caa59b16f46a8723d0505d": ""
        },
        "tags": []
    },
    "coupon_id": "525e8672be85f1ba37000003",
    "iso": {
        "startDate": "2018-07-24T00:00:00+0200",
        "stopDate": "2100-12-11T23:59:59+0100"
    }
}
					

Create new coupon

POST
/coupons/coupon.json
code required (string) Coupon Code, must be unique on your e-commerce
name required (string) Coupon Name, useful to identify which coupon has been used by customers
type required (int) Coupon Type 1 = Percentage Discount 0 => Fixed amount discount
value required (float) Coupon amount
min_sum required (float) Min Checkout total to apply discount, Must be >= 0
active required (int) 1 = Discount Code active, 0 = Discount Code deactive
start_time required (timestamp) Validity Coupon Start Date
end_time required (timestamp) Validity Coupon End Date
unlimited required (int) 1 = Coupon usage unlimited, 0 = Coupon usage limited by "count" field
count required (int) Max coupon usage
rules[users_email] required (array|string) Email address(es) of users that can use coupon
Create new coupon Request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['code'] = 'Coupon2020BlackFriday';
$payload['name'] = 'BlackFriday 2020';
$payload['type'] = 0;
$payload['value'] = 10;
$payload['min_sum'] = 30;
$payload['active'] = 1;
$payload['start_time'] = 1588118400;
$payload['end_time'] = 1590661112;
$payload['unlimited'] = 0;
$payload['count'] = 10;
$payload['rules'] = null;

$result = $storeden->post('/coupons/coupon.json', $payload);
					
Create new coupon Response

{
    "coupon_code": "Coupon2018BlackFriday",
    "uid": 1227830,
    "unique_id": "5c366ae816f46a0912a92aa5",
    "endpoint": "https://connect.storeden.com/v1.1/coupons/coupon.json?uid=1227830"
}
					

Remove Coupon

Remove single coupon from availables coupon list

DELETE
/coupons/coupon.json
uid required (int) Unique uid of coupon
Create new coupon Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->delete('/coupons/coupon.json', ['uid' => 1227830]);
					
Remove Coupon Response

{
    "ok": 1,
    "n": 1,
    "err": null,
    "errmsg": null
}