Language

2Checkout Documentation

List

You must specify your API username and password when creating your 2checkout-node object (named ‘tco’ in these examples) before calling this method.

Description

Use to retrieve a list of coupons.

Arguments

  • callback - Function to be called on success/error

Returns

  • Array of coupon objects.

Example Usage:

tco.coupons.list(function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});

Example Response:

{
    "coupon": [
        {
            "coupon_code": "TESTPERCENT",
            "date_expire": "2013-06-30",
            "minimum_purchase": "1.00",
            "percentage_off": "0.10",
            "type": "product",
            "value_off": null
        },
        {
            "coupon_code": "APITEST002",
            "date_expire": "2012-12-31",
            "minimum_purchase": "5.00",
            "percentage_off": "0.05",
            "type": "sale",
            "value_off": null
        },
        {
            "coupon_code": "APITEST003",
            "date_expire": "2012-12-31",
            "minimum_purchase": "5.00",
            "percentage_off": "0.01",
            "type": "sale",
            "value_off": null
        },
        {
            "coupon_code": "APITEST004",
            "date_expire": "2012-12-31",
            "minimum_purchase": "5.00",
            "percentage_off": "0.02",
            "type": "sale",
            "value_off": null
        },
        {
            "coupon_code": "PERCENTALL",
            "date_expire": "2012-05-04",
            "minimum_purchase": "10.00",
            "percentage_off": "0.10",
            "type": "product",
            "value_off": null
        }
    ],
    "response_code": "OK",
    "response_message": "Coupon information retrieved successfully."
}