Language

2Checkout Documentation

List Coupons

The list_coupons call is used to retrieve list of all coupons in the account.

URL: https://www.2checkout.com/api/products/list_coupons

HTTP Method: GET


Input Parameters

No input parameters required.


Data Returned

coupon

Parameter Description
coupon_code The string value of coupon code.
vendor_id Merchant ID (2Checkout Account Number) of user.
date_expire Expiration Date.(YYYY-MM-DD)
percentage_off Percentage Discount.
value_off Fixed Discount.
type Coupon type.
minimum_purchase Minimum purchase amount.
product_id ID of product selected for coupon.

Example API Call

Twocheckout::username('APIuser1817037');
Twocheckout::password('APIpass1817037');


$result = Twocheckout_Coupon::retrieve();
Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

coupons = Twocheckout::Coupon.list()
args = {};

tco.coupons.retrieve(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});
twocheckout.Api.credentials({'username':'APIuser1817037', 'password':'APIpass1817037'})

params = {
    'coupon_code': 'PYTEST12'
    }

coupon = twocheckout.Coupon.list(params)
var ServiceObject = new CouponService();
var result = ServiceObject.List();
HashMap params = new HashMap();
params.put("pagesize", "3");

CouponList result = TwocheckoutCoupon.list(params);
curl -G https://www.2checkout.com/api/products/list_coupons \
    -H 'Accept: application/json' -u 'username:password'

Example Successful 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."
    }

Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter:
RECORD_NOT_FOUND Unable to find record.